Skip to content

Commit da89e8e

Browse files
committed
Testing default registry host value in pipeline
1 parent 56098cb commit da89e8e

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

.azuredevops/templates/steps/tf_plan.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ parameters:
44
- name: tfCommandOptions
55
type: string
66
default: ''
7-
- name: imageHash
8-
type: string
9-
default: ''
10-
- name: registryHost
11-
type: string
127

138
steps:
149
- template: tf_init.yaml
@@ -32,8 +27,8 @@ steps:
3227
commandOptions: >
3328
-input=false
3429
-var-file=$(tfVarsFile)
35-
-var="image_commit_hash=${{ parameters.imageHash }}"
36-
-var="registry_host=${{ parameters.registryHost }}"
30+
-var="image_commit_hash=$(imageHash)"
31+
-var="registry_host=$(registryHost)"
3732
${{ parameters.tfCommandOptions }}
3833
-out=$(Build.ArtifactStagingDirectory)/$(ENVIRONMENT).tfplan
3934
environmentServiceNameAzureRM: $(SERVICE_CONNECTION)

.github/workflows/stage-3-build.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
with:
6565
repository: NHSDigital/dtos-devops-templates
6666
path: templates
67-
ref: main
67+
ref: feat/dtoss-9326-trigger-cd-pipeline-with-commit
6868

6969
- name: Determine which Docker container(s) to build
7070
id: get-function-names
@@ -126,7 +126,7 @@ jobs:
126126
with:
127127
repository: NHSDigital/dtos-devops-templates
128128
path: templates
129-
ref: main
129+
ref: feat/dtoss-9326-trigger-cd-pipeline-with-commit
130130

131131
- name: Build Docker image
132132
id: docker_image
@@ -151,23 +151,23 @@ jobs:
151151
[[ -n "${ENVIRONMENT_TAG}" ]] && docker tag "${image_lc}:latest" "${reg_image}:${ENVIRONMENT_TAG}"
152152
153153
- name: AzureCLI login
154-
if: (github.ref == 'refs/heads/main' && env.USE_AZURECR == 'true')
154+
#if: (github.ref == 'refs/heads/main' && env.USE_AZURECR == 'true')
155155
uses: azure/login@v2
156156
with:
157157
client-id: ${{ secrets.AZURE_CLIENT_ID }}
158158
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
159159
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
160160

161161
- name: ghcr.io login
162-
if: (github.ref == 'refs/heads/main' && env.USE_AZURECR == 'false')
162+
#if: (github.ref == 'refs/heads/main' && env.USE_AZURECR == 'false')
163163
uses: docker/login-action@v3
164164
with:
165165
registry: ghcr.io
166166
username: ${{ github.actor }}
167167
password: ${{ github.token }}
168168

169169
- name: Push Docker image
170-
if: github.ref == 'refs/heads/main'
170+
#if: github.ref == 'refs/heads/main'
171171
working-directory: ${{ needs.containers-to-build.outputs.docker_compose_dir }}
172172
env:
173173
pr_num_tag: ${{ needs.containers-to-build.outputs.pr_num_tag }}
@@ -191,7 +191,7 @@ jobs:
191191

192192
tag-all-repositories:
193193
name: Merge commit tag all images
194-
if: github.ref == 'refs/heads/main'
194+
#if: github.ref == 'refs/heads/main'
195195
runs-on: ubuntu-latest
196196
needs: [build-and-push, containers-to-build]
197197
env:
@@ -213,7 +213,7 @@ jobs:
213213
with:
214214
repository: NHSDigital/dtos-devops-templates
215215
path: templates
216-
ref: main
216+
ref: feat/dtoss-9326-trigger-cd-pipeline-with-commit
217217

218218
- name: AzureCLI login
219219
if: env.USE_AZURECR == 'true'
@@ -235,7 +235,7 @@ jobs:
235235
env:
236236
container_registry: ${{ env.REGISTRY_HOST }}
237237
docker_services: >-
238-
${{ join(fromJSON(needs.containers-to-build.outputs.docker_services || '[]'), ',') }}
238+
${{ needs.containers-to-build.outputs.docker_services && join(fromJSON(needs.containers-to-build.outputs.docker_services || '[]'), ',') }}
239239
run: |
240240
echo Running 'docker buildx imagetools' on remote repositories...
241241
@@ -261,15 +261,18 @@ jobs:
261261

262262
- name: Call deployment pipeline
263263
if: success()
264+
env:
265+
container_registry: ${{ env.REGISTRY_HOST }}
264266
run: |
265267
az pipelines run \
266-
--branch "main" \
268+
--branch "feat/dtoss-9326-trigger-cd-pipeline-with-commit" \
267269
--name cd-infrastructure-dev-core \
268270
--org https://dev.azure.com/nhse-dtos \
269271
--project ${project_name} \
270-
--parameters \
272+
--variables \
271273
imageHash="${short_commit_hash}" \
272-
registryHost="${REGISTRY_HOST}"
274+
registryHost="${container_registry,,}"
275+
273276
274277
aggregate-reports:
275278
name: Aggregate reports

0 commit comments

Comments
 (0)