Attempt to inject git info for docker builds

This commit is contained in:
Travis Shivers 2020-07-22 15:53:25 -05:00
parent 7ead58bb52
commit 593bb4a235
No known key found for this signature in database
GPG Key ID: EE4CC2891B8FCD33
3 changed files with 15 additions and 2 deletions

13
hooks/build Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
echo "SOURCE_COMMIT: $SOURCE_COMMIT"
if [[ -z "$SOURCE_COMMIT" ]]; then
export SOURCE_COMMIT="${SOURCE_COMMIT:-$(git rev-parse HEAD)}"
echo "Updating SOURCE_COMMIT from git rev-parse HEAD"
echo "SOURCE_COMMIT: $SOURCE_COMMIT"
fi
echo "DOCKER_TAG: $DOCKER_TAG"
docker build --build-arg "SOURCE_COMMIT=$SOURCE_COMMIT" -f $DOCKERFILE_PATH -t $IMAGE_NAME .

View File

@ -546,7 +546,6 @@ export default {
if (this.GET_ROOM) {
await this.joinRoom()
.catch(() => {});
}
} catch (e) {
this.serverError = `Failed to connect to ${this.selectedServer.url}`;

View File

@ -16,7 +16,6 @@ try {
// Sometimes on CI stuff they build with .git being present
// TODO: find better way to do this
process.env.VUE_APP_GIT_DATE = new Date().toISOString();
console.log('env', process.env);
if (process.env.SOURCE_COMMIT) {
process.env.VUE_APP_GIT_HASH = process.env.SOURCE_COMMIT.substring(0, 7);
@ -27,6 +26,8 @@ try {
}
}
console.log('env', process.env);
module.exports = {
lintOnSave: process.env.NODE_ENV !== 'production',
productionSourceMap: false,