Skip to content

Commit b3fa1f7

Browse files
authored
Merge pull request #94 from clearlydefined/elr/version-in-docker
add version and sha in docker image instead of Azure configs
2 parents 89e3f89 + b5da786 commit b3fa1f7

4 files changed

Lines changed: 17 additions & 30 deletions

File tree

.github/workflows/app-build-and-deploy.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This workflow will build a docker image, push it to ghcr.io, and deploy it to an Azure WebApp.
2-
# v2.0.0 - This tag coordinates the other reusable parts of this workflow.
2+
# v3.0.0 - This tag coordinates the other reusable parts of this workflow.
33
# * app-build-docker-image.yml
44
# * app-deploy-to-azure.yml
55
# * app-is-deployable.yml
@@ -79,7 +79,7 @@ jobs:
7979
uses: actions/checkout@v4.1.1
8080
with:
8181
repository: 'clearlydefined/operations'
82-
ref: 'v2.0.0'
82+
ref: 'v3.0.0'
8383
path: 'operations'
8484
- name: Get version from package-lock.json
8585
id: get_version
@@ -97,20 +97,20 @@ jobs:
9797
build-and-publish-image:
9898
name: Build and publish Docker image
9999
needs: get-version
100-
uses: clearlydefined/operations/.github/workflows/app-build-docker-image.yml@v2.0.0
100+
uses: ./.github/workflows/app-build-docker-image.yml
101101
secrets:
102102
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
103103
PRODUCTION_DEPLOYERS: ${{ secrets.PRODUCTION_DEPLOYERS }}
104104
with:
105105
deploy-env: ${{ inputs.deploy-env }}
106106
application-type: ${{ inputs.application-type }}
107-
image-tag: ${{ needs.get-version.outputs.version }}
107+
application-version: ${{ needs.get-version.outputs.version }}
108108
build-args: ${{ inputs.docker-build-args }}
109109

110110
deploy-primary-app-to-azure:
111111
name: Deploy to primary Azure app
112112
needs: [get-version, build-and-publish-image]
113-
uses: clearlydefined/operations/.github/workflows/app-deploy-to-azure.yml@v2.0.0
113+
uses: ./.github/workflows/app-deploy-to-azure.yml
114114
secrets:
115115
AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
116116
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
@@ -119,14 +119,13 @@ jobs:
119119
with:
120120
deploy-env: ${{ inputs.deploy-env }}
121121
azure-webapp-name: ${{ inputs.azure-app-base-name }}${{ inputs.azure-app-name-postfix }}
122-
application-version: ${{ needs.get-version.outputs.version }}
123122
image-name-with-tag: ${{ needs.build-and-publish-image.outputs.docker-image-name-with-tag }}
124123

125124
deploy-secondary-app-to-azure:
126125
name: Deploy to secondary Azure app
127126
if: ${{ inputs.secondary-azure-app-name-postfix != '' }}
128127
needs: [get-version, build-and-publish-image]
129-
uses: clearlydefined/operations/.github/workflows/app-deploy-to-azure.yml@v2.0.0
128+
uses: ./.github/workflows/app-deploy-to-azure.yml
130129
secrets:
131130
AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_SECONDARY_WEBAPP_PUBLISH_PROFILE }}
132131
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
@@ -135,5 +134,4 @@ jobs:
135134
with:
136135
deploy-env: ${{ inputs.deploy-env }}
137136
azure-webapp-name: ${{ inputs.azure-app-base-name }}${{ inputs.secondary-azure-app-name-postfix }}
138-
application-version: ${{ needs.get-version.outputs.version }}
139137
image-name-with-tag: ${{ needs.build-and-publish-image.outputs.docker-image-name-with-tag }}

.github/workflows/app-build-docker-image.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
description: 'application type (i.e. api | worker | ui) - used as a label for the Docker image'
2121
required: true
2222
type: string
23-
image-tag:
23+
application-version:
2424
description: 'the tag to use for the image (e.g. prod: v1.2.0, dev: v1.2.0+dev:1D3F567890)'
2525
required: true
2626
type: string
@@ -35,7 +35,7 @@ on:
3535

3636
jobs:
3737
check-deployable:
38-
uses: clearlydefined/operations/.github/workflows/app-is-deployable.yml@v2.0.0
38+
uses: ./.github/workflows/app-is-deployable.yml
3939
with:
4040
deploy-env: ${{ inputs.deploy-env }}
4141
secrets:
@@ -52,7 +52,7 @@ jobs:
5252
uses: actions/checkout@v4.1.1
5353
with:
5454
repository: 'clearlydefined/operations'
55-
ref: 'v2.0.0'
55+
ref: 'v3.0.0'
5656
path: 'operations'
5757
- name: Determine Docker Image Name
5858
id: determine_image_name
@@ -61,7 +61,7 @@ jobs:
6161
script_log=$(./operations/scripts/app-workflows/determine-image-name.sh \
6262
"${{ github.repository }}" \
6363
"${{ inputs.deploy-env }}" \
64-
"${{ inputs.image-tag }}") || (echo "$script_log" && exit 1)
64+
"${{ inputs.application-version }}") || (echo "$script_log" && exit 1)
6565
echo -e "---- script log\n$script_log\n----"; \
6666
image_name=$(echo "$script_log" | tail -n 1)
6767
echo "DOCKER_IMAGE_NAME_WITH_TAG=$image_name" >> $GITHUB_ENV
@@ -87,7 +87,10 @@ jobs:
8787
context: .
8888
push: true
8989
file: Dockerfile
90-
build-args: ${{ inputs.build-args }}
90+
build-args: |
91+
APP_VERSION=${{ inputs.application-version }}
92+
BUILD_SHA=${{ github.sha }}
93+
${{ inputs.build-args }}
9194
tags: ${{ needs.determine-image-name.outputs.docker-image-name-with-tag }}
9295
labels: |
9396
env=${{ inputs.deploy-env }}

.github/workflows/app-deploy-to-azure.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,14 @@ on:
2626
description: 'Azure application name of application to deploy (i.e. clearlydefined-api | cdcrawler | clearlydefined)'
2727
required: true
2828
type: string
29-
application-version:
30-
description: 'the tag to use for the image (e.g. prod: v1.2.0, dev: v1.2.0+dev:1D3F567890)'
31-
required: true
32-
type: string
3329
image-name-with-tag:
3430
description: 'Docker image name with the tag (e.g. ghcr.io/clearlydefined/clearlydefined-api:v1.2.0)'
3531
required: true
3632
type: string
3733

3834
jobs:
3935
check-deployable:
40-
uses: clearlydefined/operations/.github/workflows/app-is-deployable.yml@v2.0.0
36+
uses: ./.github/workflows/app-is-deployable.yml
4137
with:
4238
deploy-env: ${{ inputs.deploy-env }}
4339
secrets:
@@ -69,16 +65,6 @@ jobs:
6965
"name": "DOCKER_REGISTRY_SERVER_URL",
7066
"value": "https://ghcr.io",
7167
"slotSetting": false
72-
},
73-
{
74-
"name": "APP_VERSION",
75-
"value": "${{ inputs.application-version }}",
76-
"slotSetting": false
77-
},
78-
{
79-
"name": "BUILD_SHA",
80-
"value": "${{ github.sha }}",
81-
"slotSetting": false
8268
}
8369
]
8470

.github/workflows/app-is-deployable.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: actions/checkout@v4.1.1
2727
with:
2828
repository: 'clearlydefined/operations'
29-
ref: 'v2.0.0'
29+
ref: 'v3.0.0'
3030
path: 'operations'
3131
- id: confirm-dev
3232
shell: bash
@@ -47,7 +47,7 @@ jobs:
4747
uses: actions/checkout@v4.1.1
4848
with:
4949
repository: 'clearlydefined/operations'
50-
ref: 'v2.0.0'
50+
ref: 'v3.0.0'
5151
path: 'operations'
5252

5353
- name: Get organization ID

0 commit comments

Comments
 (0)