Skip to content

Commit 6e9ab18

Browse files
authored
feat: 5950 build logstash container image pipeline (#548)
* feat: reformatting batch module * fix: update secrets file var * fix: added service identifiers * fix: modified run command * fix: var ref * fix: updated pipelines * fix: update search tag var * fix: updated deploy-env * fix: add continue on error to docker security * fix: linting * fix: move continue on error * fix: allow security-docker to fail * fix: only run app for app changes * fix: removed docker-files from app conditional * fix: add null to app conditional * fix: download artefact conditional * fix: if not search * fix: add production target to search dockerfile
1 parent 4e78843 commit 6e9ab18

File tree

19 files changed

+1081
-208
lines changed

19 files changed

+1081
-208
lines changed

.github/workflows/cd.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
should-build-and-push-cli-docker: ${{ needs.release-please.outputs.release_created || steps.changed-cli-docker-files.outputs.any_modified == 'true' || steps.changed-api-files.outputs.any_modified == 'true' || null }}
4646
should-build-and-push-selfserve-docker: ${{ needs.release-please.outputs.release_created || steps.changed-selfserve-docker-files.outputs.any_modified == 'true' || steps.changed-selfserve-files.outputs.any_modified == 'true' || null }}
4747
should-build-and-push-internal-docker: ${{ needs.release-please.outputs.release_created || steps.changed-internal-docker-files.outputs.any_modified == 'true' || steps.changed-internal-files.outputs.any_modified == 'true' || null }}
48+
should-build-and-push-search-docker: ${{ needs.release-please.outputs.release_created || steps.changed-search-docker-files.outputs.any_modified == 'true' || steps.changed-search-files.outputs.any_modified == 'true' || null }}
4849
# Terraform account
4950
should-apply-account-terraform: ${{ needs.release-please.outputs.release_created || steps.changed-accounts-terraform-files.outputs.any_modified == 'true' || null }}
5051
# Terraform environment
@@ -93,6 +94,11 @@ jobs:
9394
with:
9495
files: |
9596
infra/docker/internal/**
97+
- uses: tj-actions/changed-files@v45
98+
id: changed-seaerch-docker-files
99+
with:
100+
files: |
101+
infra/docker/seaerch/**
96102
- uses: tj-actions/changed-files@v45
97103
id: changed-accounts-terraform-files
98104
with:
@@ -144,6 +150,7 @@ jobs:
144150
selfserve: ${{ steps.selfserve-version.outputs.version }}
145151
internal: ${{ steps.internal-version.outputs.version }}
146152
assets: ${{ steps.assets-version.outputs.version }}
153+
search: ${{ steps.search-version.outputs.version }}
147154
steps:
148155
- uses: actions/checkout@v4
149156
with:
@@ -168,6 +175,10 @@ jobs:
168175
uses: dvsa/.github/.github/actions/get-vol-app-version@v5.0.3
169176
with:
170177
project-path: app/cdn
178+
- id: search-version
179+
uses: dvsa/.github/.github/actions/get-vol-app-version@v5.0.3
180+
with:
181+
project-path: infra/docker/search
171182
- name: Add to summary
172183
run: |
173184
echo "#### App versions:" >> $GITHUB_STEP_SUMMARY
@@ -176,6 +187,7 @@ jobs:
176187
echo "**Selfserve**: \`${{ steps.selfserve-version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
177188
echo "**Internal**: \`${{ steps.internal-version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
178189
echo "**Assets**: \`${{ steps.assets-version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
190+
echo "**Search**: \`${{ steps.search-version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
179191
180192
cdn-nonprod:
181193
name: CDN
@@ -239,11 +251,13 @@ jobs:
239251
- cli
240252
- selfserve
241253
- internal
254+
- search
242255
exclude:
243256
- project: ${{ needs.orchestrator.outputs.should-build-and-push-api-docker && 'ignored' || 'api' }}
244257
- project: ${{ needs.orchestrator.outputs.should-build-and-push-cli-docker && 'ignored' || 'cli' }}
245258
- project: ${{ needs.orchestrator.outputs.should-build-and-push-selfserve-docker && 'ignored' || 'selfserve' }}
246259
- project: ${{ needs.orchestrator.outputs.should-build-and-push-internal-docker && 'ignored' || 'internal' }}
260+
- project: ${{ needs.orchestrator.outputs.should-build-and-push-search-docker && 'ignored' || 'search' }}
247261
uses: ./.github/workflows/docker.yaml
248262
with:
249263
project: ${{ matrix.project }}

.github/workflows/ci.yaml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
# Docs
3737
should-build-docs: ${{ steps.changed-website-files.outputs.any_modified == 'true' || null }}
3838
# App
39-
should-build-app: ${{ steps.changed-app-files.outputs.any_modified == 'true' || steps.changed-docker-files.outputs.any_modified == 'true' || null }}
39+
should-build-app: ${{ steps.changed-app-files.outputs.any_modified == 'true' || null }}
4040
should-build-api: ${{ contains(steps.changed-app-files.outputs.all_modified_files, 'app/api') || null }}
4141
should-build-selfserve: ${{ contains(steps.changed-app-files.outputs.all_modified_files, 'app/selfserve') || null }}
4242
should-build-internal: ${{ contains(steps.changed-app-files.outputs.all_modified_files, 'app/internal') || null }}
@@ -48,6 +48,7 @@ jobs:
4848
should-build-cli-docker: ${{ contains(steps.changed-docker-files.outputs.all_modified_files, 'infra/docker/cli') || null }}
4949
should-build-selfserve-docker: ${{ contains(steps.changed-docker-files.outputs.all_modified_files, 'infra/docker/selfserve') || null }}
5050
should-build-internal-docker: ${{ contains(steps.changed-docker-files.outputs.all_modified_files, 'infra/docker/internal') || null }}
51+
should-build-search-docker: ${{ contains(steps.changed-docker-files.outputs.all_modified_files, 'infra/docker/search') || null }}
5152
# Terraform accounts
5253
should-plan-terraform-accounts: ${{ steps.changed-accounts-terraform-files.outputs.any_modified == 'true' || null }}
5354
should-plan-nonprod-account-terraform: ${{ contains(steps.changed-accounts-terraform-files.outputs.all_modified_files, 'infra/terraform/modules') || contains(steps.changed-accounts-terraform-files.outputs.all_modified_files, 'infra/terraform/accounts/nonprod') || null }}
@@ -142,6 +143,7 @@ jobs:
142143
selfserve: ${{ steps.selfserve-version.outputs.version }}
143144
internal: ${{ steps.internal-version.outputs.version }}
144145
assets: ${{ steps.assets-version.outputs.version }}
146+
search: ${{ steps.search-version.outputs.version }}
145147
steps:
146148
- uses: actions/checkout@v4
147149
with:
@@ -167,13 +169,18 @@ jobs:
167169
uses: dvsa/.github/.github/actions/get-vol-app-version@v5.0.3
168170
with:
169171
project-path: app/cdn
172+
- id: search-version
173+
uses: dvsa/.github/.github/actions/get-vol-app-version@v5.0.3
174+
with:
175+
project-path: infra/docker/search
170176
- name: Add to summary
171177
run: |
172178
echo "#### App versions:" >> $GITHUB_STEP_SUMMARY
173179
echo "**API**: \`${{ steps.api-version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
174180
echo "**Selfserve**: \`${{ steps.selfserve-version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
175181
echo "**Internal**: \`${{ steps.internal-version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
176182
echo "**Assets**: \`${{ steps.assets-version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
183+
echo "**Search**: \`${{ steps.search-version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
177184
178185
cdn:
179186
name: CDN
@@ -193,7 +200,11 @@ jobs:
193200

194201
app:
195202
name: App
196-
if: ${{ needs.orchestrator.outputs.should-build-app || needs.orchestrator.outputs.should-build-docker }}
203+
if: >
204+
needs.orchestrator.outputs.should-build-app ||
205+
needs.orchestrator.outputs.should-build-api-docker ||
206+
needs.orchestrator.outputs.should-build-selfserve-docker ||
207+
needs.orchestrator.outputs.should-build-internal-docker
197208
concurrency:
198209
group: app-${{ matrix.project }}-${{ needs.get-version.outputs[matrix.project] }}
199210
needs:
@@ -221,13 +232,27 @@ jobs:
221232

222233
docker:
223234
name: Docker
224-
if: ${{ always() && !cancelled() && !failure() && needs.orchestrator.outputs.should-build-docker }}
235+
if: >
236+
always() &&
237+
!cancelled() &&
238+
needs.orchestrator.outputs.should-build-docker &&
239+
needs.security-app.result != 'failure' &&
240+
needs.security-terraform.result != 'failure' &&
241+
needs.orchestrator.result != 'failure' &&
242+
needs.docs.result != 'failure' &&
243+
needs.cdn.result != 'failure' &&
244+
needs.app.result != 'failure' &&
245+
needs.get-version.result != 'failure'
225246
concurrency:
226247
group: docker-${{ matrix.project }}-${{ needs.get-version.outputs[matrix.project] }}
227248
needs:
249+
- security-app
250+
- security-terraform
228251
- orchestrator
229-
- get-version
252+
- docs
253+
- cdn
230254
- app
255+
- get-version
231256
strategy:
232257
fail-fast: false
233258
matrix:
@@ -236,11 +261,13 @@ jobs:
236261
- cli
237262
- selfserve
238263
- internal
264+
- search
239265
exclude:
240266
- project: ${{ needs.orchestrator.outputs.should-build-api-docker && 'ignored' || 'api' }}
241267
- project: ${{ needs.orchestrator.outputs.should-build-cli-docker && 'ignored' || 'cli' }}
242268
- project: ${{ needs.orchestrator.outputs.should-build-selfserve-docker && 'ignored' || 'selfserve' }}
243269
- project: ${{ needs.orchestrator.outputs.should-build-internal-docker && 'ignored' || 'internal' }}
270+
- project: ${{ needs.orchestrator.outputs.should-build-search-docker && 'ignored' || 'search' }}
244271
uses: ./.github/workflows/docker.yaml
245272
with:
246273
project: ${{ matrix.project }}
@@ -328,6 +355,7 @@ jobs:
328355
selfserve-image-tag: ${{ needs.get-version.outputs.selfserve }}
329356
internal-image-tag: ${{ needs.get-version.outputs.internal }}
330357
assets-version: ${{ needs.get-version.outputs.assets }}
358+
search-image-tag: ${{ needs.get-version.outputs.search }}
331359
permissions:
332360
contents: read
333361
id-token: write

.github/workflows/deploy-environment.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ on:
3232
description: "Internal image tag"
3333
type: string
3434
required: true
35+
search-image-tag:
36+
description: "Search image tag"
37+
type: string
38+
required: true
3539
assets-version:
3640
description: "Assets version"
3741
type: string
@@ -70,6 +74,9 @@ on:
7074
internal-image-tag:
7175
type: string
7276
required: true
77+
search-image-tag:
78+
type: string
79+
required: true
7380
assets-version:
7481
type: string
7582
required: true
@@ -101,6 +108,9 @@ on:
101108
previous_internal_image_tag:
102109
description: "Previous Internal image tag"
103110
value: ${{ jobs.deploy.outputs.previous_internal_image_tag }}
111+
previous_search_image_tag:
112+
description: "Previous Search image tag"
113+
value: ${{ jobs.deploy.outputs.previous_search_image_tag }}
104114
previous_assets_version:
105115
description: "Previous Assets version"
106116
value: ${{ jobs.deploy.outputs.previous_assets_version }}
@@ -128,6 +138,7 @@ jobs:
128138
previous_cli_image_tag: ${{ steps.get_current_versions.outputs.cli_image_tag }}
129139
previous_selfserve_image_tag: ${{ steps.get_current_versions.outputs.selfserve_image_tag }}
130140
previous_internal_image_tag: ${{ steps.get_current_versions.outputs.internal_image_tag }}
141+
previous_search_image_tag: ${{ steps.get_current_versions.outputs.search_image_tag }}
131142
previous_assets_version: ${{ steps.get_current_versions.outputs.assets_version }}
132143
env:
133144
WORKING_DIR: infra/terraform/environments/${{ inputs.environment }}
@@ -183,6 +194,7 @@ jobs:
183194
TF_VAR_cli_image_tag: ${{ inputs.cli-image-tag }}
184195
TF_VAR_selfserve_image_tag: ${{ inputs.selfserve-image-tag }}
185196
TF_VAR_internal_image_tag: ${{ inputs.internal-image-tag }}
197+
TF_VAR_search_image_tag: ${{ inputs.search-image-tag }}
186198
TF_VAR_assets_version: ${{ inputs.assets-version }}
187199
run: terraform plan -parallelism=80 ${{ inputs.destroy && '-destroy ' || '' }} -no-color -input=false -out=tfplan ${{ inputs.terraform-args || '' }}
188200

@@ -254,6 +266,7 @@ jobs:
254266
**CLI version:** ${{ inputs.cli-image-tag }}
255267
**Selfserve version:** ${{ inputs.selfserve-image-tag }}
256268
**Internal version:** ${{ inputs.internal-image-tag }}
269+
**search version:** ${{ inputs.search-image-tag }}
257270
258271
### Plan summary
259272
@@ -295,6 +308,7 @@ jobs:
295308
TF_VAR_cli_image_tag: ${{ inputs.cli-image-tag }}
296309
TF_VAR_selfserve_image_tag: ${{ inputs.selfserve-image-tag }}
297310
TF_VAR_internal_image_tag: ${{ inputs.internal-image-tag }}
311+
TF_VAR_search_image_tag: ${{ inputs.search-image-tag }}
298312
TF_VAR_assets_version: ${{ inputs.assets-version }}
299313
run: terraform apply -parallelism=80 ${{ inputs.destroy && '-destroy ' || '' }} -no-color -input=false -auto-approve ${{ inputs.terraform-args || '' }}
300314

@@ -312,6 +326,7 @@ jobs:
312326
echo "- CLI: ${{ inputs.cli-image-tag }}" >> $GITHUB_STEP_SUMMARY
313327
echo "- Selfserve: ${{ inputs.selfserve-image-tag }}" >> $GITHUB_STEP_SUMMARY
314328
echo "- Internal: ${{ inputs.internal-image-tag }}" >> $GITHUB_STEP_SUMMARY
329+
echo "- Search: ${{ inputs.search-image-tag }}" >> $GITHUB_STEP_SUMMARY
315330
echo "- Assets: ${{ inputs.assets-version }}" >> $GITHUB_STEP_SUMMARY
316331
317332
- name: Set outputs

.github/workflows/docker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
fetch-depth: ${{ !inputs.ref && 1 || 0 }}
5858

5959
- uses: actions/download-artifact@v4
60+
if: ${{ inputs.app-artefact-name != 'search' }}
6061
with:
6162
name: ${{ inputs.app-artefact-name }}
6263
path: infra/docker/${{ inputs.project }}

infra/docker/search/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ghcr.io/dvsa/dvsa-docker-images/logstash/8.16.0/batch:0 AS search
2+
3+
FROM search AS production
4+
5+
# Delete default configuration
6+
RUN rm -f /usr/share/logstash/pipeline/logstash.conf
7+
8+
COPY config/ /usr/share/logstash/config/
9+
10+
COPY entrypoint.sh /usr/share/logstash/entrypoint.sh
11+
COPY build.sh /usr/share/logstash/build.sh
12+
13+
CMD ["/usr/share/logstash/entrypoint.sh"]

0 commit comments

Comments
 (0)