From 3831bd00bb790f4a5c3622814ce637cc8d29e14c Mon Sep 17 00:00:00 2001 From: "E. Lynette Rayle" Date: Mon, 30 Sep 2024 08:11:20 -0400 Subject: [PATCH 1/5] add APP_VERSION & BUILD_SHA to Dockerfiles add closing curly brace to status message --- DevDockerfile | 8 +++++++- Dockerfile | 8 +++++++- routes/index.js | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/DevDockerfile b/DevDockerfile index 00b490fc9..8cb4d0d45 100644 --- a/DevDockerfile +++ b/DevDockerfile @@ -15,8 +15,14 @@ ENV APPDIR=/opt/service # COPY init_container.sh /bin/ # RUN chmod 755 /bin/init_container.sh # CMD ["/bin/init_container.sh"] + +# Set environment variables from build arguments ARG BUILD_NUMBER=0 -ENV BUILD_NUMBER=$BUILD_NUMBER +ENV BUILD_NUMBER=$APP_VERSION +ARG APP_VERSION="UNKNOWN" +ENV APP_VERSION=$APP_VERSION +ARG BUILD_SHA="UNKNOWN" +ENV BUILD_SHA=$BUILD_SHA COPY patches /tmp/patches COPY .npmrc package*.json /tmp/ diff --git a/Dockerfile b/Dockerfile index f3b00009e..73030d99d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,14 @@ ENV APPDIR=/opt/service # COPY init_container.sh /bin/ # RUN chmod 755 /bin/init_container.sh # CMD ["/bin/init_container.sh"] + +# Set environment variables from build arguments ARG BUILD_NUMBER=0 -ENV BUILD_NUMBER=$BUILD_NUMBER +ENV BUILD_NUMBER=$APP_VERSION +ARG APP_VERSION="UNKNOWN" +ENV APP_VERSION=$APP_VERSION +ARG BUILD_SHA="UNKNOWN" +ENV BUILD_SHA=$BUILD_SHA COPY patches /tmp/patches COPY .npmrc package*.json /tmp/ diff --git a/routes/index.js b/routes/index.js index 72c7e6253..24ed370eb 100644 --- a/routes/index.js +++ b/routes/index.js @@ -4,7 +4,7 @@ const express = require('express') const router = express.Router() router.get('/', function (req, res) { - const msg = `{ "status": "OK", "version": "${version}", "sha": "${sha}"` + const msg = `{ "status": "OK", "version": "${version}", "sha": "${sha}" }` res.status(200).send(msg) }) From 3af9cac75deca2c6b26258c3ad44c5f9403242c9 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Tue, 1 Oct 2024 14:11:09 +0100 Subject: [PATCH 2/5] point to action branch for testing --- .github/workflows/build-and-deploy-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy-dev.yml b/.github/workflows/build-and-deploy-dev.yml index 86aa21dba..a93d7edc6 100644 --- a/.github/workflows/build-and-deploy-dev.yml +++ b/.github/workflows/build-and-deploy-dev.yml @@ -23,7 +23,7 @@ jobs: build-and-deploy: name: Build and Deploy needs: upload-package-lock-json - uses: clearlydefined/operations/.github/workflows/app-build-and-deploy.yml@v2.0.0 + uses: clearlydefined/operations/.github/workflows/app-build-and-deploy.yml@0a6c2607470e2e0e49bf2d6636223bcd62c1a7f8 secrets: AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_DEV }} From fb058165bf83e5362cd15f57ee29ca0628373b5f Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Tue, 1 Oct 2024 14:34:16 +0100 Subject: [PATCH 3/5] Log app version More explicit as that is what we are releasing --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index 846a54618..ce566c9cf 100644 --- a/app.js +++ b/app.js @@ -225,7 +225,7 @@ function createApp(config) { // Bit of trick for local hosting. Preload search if using an in-memory search service // Commenting out because I believe this is broken // if (searchService.constructor.name === 'MemorySearch') await definitionService.reload('definitions') - logger.info('Service initialized', { buildNumber: process.env.BUILD_NUMBER }) + logger.info('Service initialized', { appVersion: process.env.APP_VERSION }) // kick off the queue processors require('./providers/curation/process')(curationQueue, curationService, logger) From adb1aec58d1e59485486afca2e7e9ef2105d6e92 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Wed, 2 Oct 2024 11:09:31 +0100 Subject: [PATCH 4/5] Remove build number This is set by Azure devops image build Image is not built by azdo anymore so not needed --- DevDockerfile | 2 -- Dockerfile | 2 -- 2 files changed, 4 deletions(-) diff --git a/DevDockerfile b/DevDockerfile index 8cb4d0d45..d11bd0d0c 100644 --- a/DevDockerfile +++ b/DevDockerfile @@ -17,8 +17,6 @@ ENV APPDIR=/opt/service # CMD ["/bin/init_container.sh"] # Set environment variables from build arguments -ARG BUILD_NUMBER=0 -ENV BUILD_NUMBER=$APP_VERSION ARG APP_VERSION="UNKNOWN" ENV APP_VERSION=$APP_VERSION ARG BUILD_SHA="UNKNOWN" diff --git a/Dockerfile b/Dockerfile index 73030d99d..423b1df97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,8 +17,6 @@ ENV APPDIR=/opt/service # CMD ["/bin/init_container.sh"] # Set environment variables from build arguments -ARG BUILD_NUMBER=0 -ENV BUILD_NUMBER=$APP_VERSION ARG APP_VERSION="UNKNOWN" ENV APP_VERSION=$APP_VERSION ARG BUILD_SHA="UNKNOWN" From 6f8c8acbab2556e84461bdc5eb342b536a541f13 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Thu, 3 Oct 2024 18:23:51 +0100 Subject: [PATCH 5/5] Point to new release of workflow --- .github/workflows/build-and-deploy-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy-dev.yml b/.github/workflows/build-and-deploy-dev.yml index a93d7edc6..1f3dd177d 100644 --- a/.github/workflows/build-and-deploy-dev.yml +++ b/.github/workflows/build-and-deploy-dev.yml @@ -23,7 +23,7 @@ jobs: build-and-deploy: name: Build and Deploy needs: upload-package-lock-json - uses: clearlydefined/operations/.github/workflows/app-build-and-deploy.yml@0a6c2607470e2e0e49bf2d6636223bcd62c1a7f8 + uses: clearlydefined/operations/.github/workflows/app-build-and-deploy.yml@v3.0.0 secrets: AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_DEV }}