Skip to content

Commit c8e6169

Browse files
authored
VAULT-31402: Add verification for all container images (#28605)
* VAULT-31402: Add verification for all container images Add verification for all container images that are generated as part of the build. Before this change we only ever tested a limited subset of "default" containers based on Alpine Linux that we publish via the Docker hub and AWS ECR. Now we support testing all Alpine and UBI based container images. We also verify the repository and tag information embedded in each by deploying them and verifying the repo and tag metadata match our expectations. This does change the k8s scenario interface quite a bit. We now take in an archive image and set image/repo/tag information based on the scenario variants. To enable this I also needed to add `tar` to the UBI base image. It was already available in the Alpine image and is used to copy utilities to the image when deploying and configuring the cluster via Enos. Since some images contain multiple tags we also add samples for each image and randomly select which variant to test on a given PR. Signed-off-by: Ryan Cragun <[email protected]>
1 parent 08e8776 commit c8e6169

16 files changed

+583
-325
lines changed

.github/actions/containerize/action.yml

+44-30
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,24 @@ description: |
1010
1111
inputs:
1212
docker:
13-
type: boolean
1413
description: |
1514
Package the binary into a Docker container suitable for the Docker and AWS registries. We'll
1615
automatically determine the correct tags and target depending on the vault edition.
17-
default: true
16+
default: 'true'
1817
goarch:
19-
type: string
2018
description: The Go GOARCH value environment variable to set during the build.
2119
goos:
22-
type: string
2320
description: The Go GOOS value environment variable to set during the build.
2421
redhat:
25-
type: boolean
2622
description: Package the binary into a UBI container suitable for the Redhat Quay registry.
27-
default: false
23+
default: 'false'
2824
vault-binary-path:
29-
type: string
3025
description: The path to the vault binary.
3126
default: dist/vault
3227
vault-edition:
33-
type: string
3428
description: The edition of vault to build.
3529
default: ce
3630
vault-version:
37-
type: string
3831
description: The vault version.
3932

4033
outputs:
@@ -48,31 +41,52 @@ runs:
4841
- id: vars
4942
shell: bash
5043
run: |
51-
if [[ '${{ inputs.vault-edition }}' =~ 'ce' ]]; then
52-
# CE containers
53-
container_version='${{ inputs.vault-version }}'
54-
docker_container_tags='docker.io/hashicorp/vault:${{ inputs.vault-version }} public.ecr.aws/hashicorp/vault:${{ inputs.vault-version }}'
55-
docker_container_target='default'
56-
redhat_container_tags='quay.io/redhat-isv-containers/5f89bb5e0b94cf64cfeb500a:${{ inputs.vault-version }}-ubi'
57-
redhat_container_target='ubi'
58-
else
59-
# Ent containers
60-
container_version='${{ inputs.vault-version }}+${{ inputs.vault-edition }}'
61-
62-
if [[ '${{ inputs.vault-edition }}' =~ 'fips' ]]; then
63-
# Ent FIPS 140-2 containers
64-
docker_container_tags='docker.io/hashicorp/vault-enterprise-fips:${{ inputs.vault-version }}-${{ inputs.vault-edition }} public.ecr.aws/hashicorp/vault-enterprise-fips:${{ inputs.vault-version }}-${{ inputs.vault-edition }}'
65-
docker_container_target='ubi-fips'
66-
redhat_container_tags='quay.io/redhat-isv-containers/6283f645d02c6b16d9caeb8e:${{ inputs.vault-version }}-${{ inputs.vault-edition }}-ubi'
67-
redhat_container_target='ubi-fips'
68-
else
69-
# All other Ent containers
44+
case '${{ inputs.vault-edition }}' in
45+
"ce")
46+
container_version='${{ inputs.vault-version }}'
47+
docker_container_tags='docker.io/hashicorp/vault:${{ inputs.vault-version }} public.ecr.aws/hashicorp/vault:${{ inputs.vault-version }}'
48+
docker_container_target='default'
49+
redhat_container_tags='quay.io/redhat-isv-containers/5f89bb5e0b94cf64cfeb500a:${{ inputs.vault-version }}-ubi'
50+
redhat_container_target='ubi'
51+
;;
52+
"ent")
53+
container_version='${{ inputs.vault-version }}+${{ inputs.vault-edition }}'
7054
docker_container_tags='docker.io/hashicorp/vault-enterprise:${{ inputs.vault-version }}-${{ inputs.vault-edition}} public.ecr.aws/hashicorp/vault-enterprise:${{ inputs.vault-version }}-${{ inputs.vault-edition }}'
7155
docker_container_target='default'
7256
redhat_container_tags='quay.io/redhat-isv-containers/5f89bb9242e382c85087dce2:${{ inputs.vault-version }}-${{ inputs.vault-edition }}-ubi'
7357
redhat_container_target='ubi'
74-
fi
75-
fi
58+
;;
59+
"ent.hsm")
60+
container_version='${{ inputs.vault-version }}+${{ inputs.vault-edition }}'
61+
docker_container_tags='docker.io/hashicorp/vault-enterprise:${{ inputs.vault-version }}-${{ inputs.vault-edition}} public.ecr.aws/hashicorp/vault-enterprise:${{ inputs.vault-version }}-${{ inputs.vault-edition }}'
62+
docker_container_target='ubi-hsm'
63+
redhat_container_tags='quay.io/redhat-isv-containers/5f89bb9242e382c85087dce2:${{ inputs.vault-version }}-${{ inputs.vault-edition }}-ubi'
64+
redhat_container_target='ubi-hsm'
65+
;;
66+
"ent.hsm.fips1402")
67+
container_version='${{ inputs.vault-version }}+${{ inputs.vault-edition }}'
68+
docker_container_tags='docker.io/hashicorp/vault-enterprise:${{ inputs.vault-version }}-${{ inputs.vault-edition}} public.ecr.aws/hashicorp/vault-enterprise:${{ inputs.vault-version }}-${{ inputs.vault-edition }}'
69+
docker_container_target='ubi-hsm-fips'
70+
redhat_container_tags='quay.io/redhat-isv-containers/5f89bb9242e382c85087dce2:${{ inputs.vault-version }}-${{ inputs.vault-edition }}-ubi'
71+
redhat_container_target='ubi-hsm-fips'
72+
;;
73+
"ent.fips1402")
74+
# NOTE: For compatibility we still publish the ent.fips1402 containers to different
75+
# namespaces. All ent, ent.hsm, and ent.hsm.fips1402 containers are released in the
76+
# enterprise namespaces. After we've updated the upstream docker action to support
77+
# multiple tags we can start to tag images with both namespaces, publish to both, and
78+
# eventually sunset the fips1402 specific namespaces.
79+
container_version='${{ inputs.vault-version }}+${{ inputs.vault-edition }}'
80+
docker_container_tags='docker.io/hashicorp/vault-enterprise-fips:${{ inputs.vault-version }}-${{ inputs.vault-edition }} public.ecr.aws/hashicorp/vault-enterprise-fips:${{ inputs.vault-version }}-${{ inputs.vault-edition }}'
81+
docker_container_target='ubi-fips'
82+
redhat_container_tags='quay.io/redhat-isv-containers/6283f645d02c6b16d9caeb8e:${{ inputs.vault-version }}-${{ inputs.vault-edition }}-ubi'
83+
redhat_container_target='ubi-fips'
84+
;;
85+
*)
86+
echo "Cannot generate container tags for unknown vault edition: ${{ inputs.vault-edition }}" 2>&1
87+
exit 1
88+
;;
89+
esac
7690
{
7791
echo "container-version=${container_version}"
7892
echo "docker-container-tags=${docker_container_tags}"

.github/workflows/build-artifacts-ce.yml

+27-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ on:
99
inputs:
1010
build-all:
1111
type: boolean
12+
description: Build all extended artifacts
1213
default: false
1314
build-date:
1415
type: string
16+
description: The date associated with the revision SHA
1517
required: true
1618
checkout-ref:
1719
type: string
20+
description: The repo Git SHA to checkout
1821
default: ""
1922
compute-build:
2023
type: string # JSON encoded to support passing arrays
@@ -30,15 +33,19 @@ on:
3033
required: true
3134
vault-revision:
3235
type: string
36+
description: The revision SHA of vault
3337
required: true
3438
vault-version:
3539
type: string
40+
description: The version of vault
3641
required: true
3742
vault-version-package:
3843
type: string
44+
description: Whether or not to package the binary as Debian and RPM packages
3945
required: true
4046
web-ui-cache-key:
4147
type: string
48+
description: The UI asset cache key
4249
required: true
4350
workflow_call:
4451
inputs:
@@ -119,7 +126,26 @@ jobs:
119126
# Outputs are strings so we need to encode our collection outputs as JSON.
120127
testable-containers: |
121128
[
122-
{ "artifact": "${{ github.event.repository.name }}_default_linux_amd64_${{ inputs.vault-version }}_${{ inputs.vault-revision }}.docker.tar" }
129+
{
130+
"sample": "ce_default_linux_amd64_ent_docker",
131+
"artifact": "${{ github.event.repository.name }}_default_linux_amd64_${{ inputs.vault-version }}_${{ inputs.vault-revision }}.docker.tar",
132+
"edition": "ce"
133+
},
134+
{
135+
"sample": "ce_default_linux_arm64_ce_docker",
136+
"artifact": "${{ github.event.repository.name }}_default_linux_arm64_${{ inputs.vault-version }}_${{ inputs.vault-revision }}.docker.tar",
137+
"edition": "ce"
138+
},
139+
{
140+
"sample": "ce_ubi_linux_amd64_ce_redhat",
141+
"artifact": "${{ github.event.repository.name}}_ubi_linux_amd64_${{ inputs.vault-version}}_${{ inputs.vault-revision }}.docker.redhat.tar",
142+
"edition": "ce"
143+
},
144+
{
145+
"sample": "ce_ubi_linux_arm64_ce_redhat",
146+
"artifact": "${{ github.event.repository.name}}_ubi_linux_arm64_${{ inputs.vault-version}}_${{ inputs.vault-revision }}.docker.redhat.tar",
147+
"edition": "ce"
148+
}
123149
]
124150
testable-packages: |
125151
[

.github/workflows/build.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -255,16 +255,18 @@ jobs:
255255
- setup
256256
- ui
257257
- artifacts
258-
uses: ./.github/workflows/enos-run-k8s.yml
258+
uses: ./.github/workflows/test-run-enos-scenario-containers.yml
259259
strategy:
260260
fail-fast: false
261261
matrix:
262262
include: ${{ fromJSON(needs.artifacts.outputs.testable-containers) }}
263263
with:
264-
artifact-build-date: ${{ needs.setup.outputs.build-date }}
265-
artifact-name: ${{ matrix.artifact }}
266-
artifact-revision: ${{ needs.setup.outputs.vault-revision }}
267-
artifact-version: ${{ needs.setup.outputs.vault-version-metadata }}
264+
build-artifact-name: ${{ matrix.artifact }}
265+
sample-max: 1
266+
sample-name: ${{ matrix.sample }}
267+
vault-edition: ${{ matrix.edition }}
268+
vault-revision: ${{ needs.setup.outputs.vault-revision }}
269+
vault-version: ${{ needs.setup.outputs.vault-version-metadata }}
268270
secrets: inherit
269271

270272
completed-successfully:

.github/workflows/enos-run-k8s.yml

-113
This file was deleted.

0 commit comments

Comments
 (0)