Skip to content
Snippets Groups Projects
Unverified Commit 9dc38546 authored by Enno Gotthold's avatar Enno Gotthold
Browse files

Deploy custom CAs correctly on alpine base images

parent a5ca1009
No related branches found
No related tags found
No related merge requests found
...@@ -104,7 +104,19 @@ stages: ...@@ -104,7 +104,19 @@ stages:
- export RELEASE_IMAGE_TAG="${RELEASE_VERSION}${RELEASE_OPENTOFU_VERSION:+-opentofu$RELEASE_OPENTOFU_VERSION}${RELEASE_BASE_IMAGE_OS:+-$RELEASE_BASE_IMAGE_OS}" - export RELEASE_IMAGE_TAG="${RELEASE_VERSION}${RELEASE_OPENTOFU_VERSION:+-opentofu$RELEASE_OPENTOFU_VERSION}${RELEASE_BASE_IMAGE_OS:+-$RELEASE_BASE_IMAGE_OS}"
- export RELEASE_IMAGE="${RELEASE_IMAGE_NAME}:${RELEASE_IMAGE_TAG}" - export RELEASE_IMAGE="${RELEASE_IMAGE_NAME}:${RELEASE_IMAGE_TAG}"
.install-custom-ca: &install-custom-ca .install-custom-ca-alpine: &install-custom-ca-alpine
- |
if [ -f "${CUSTOM_CA}" ]; then
apk add --no-cache update-ca-certificates
mkdir -p /usr/local/share/ca-certificates/
cp "$CUSTOM_CA" /usr/local/share/ca-certificates/custom-ca.pem
update-ca-certificates
else
echo 'Skipping to install custom CA because $CUSTOM_CA environment variable is not set'
fi
.install-custom-ca-fedora: &install-custom-ca-fedora
- | - |
if [ -f "${CUSTOM_CA}" ]; then if [ -f "${CUSTOM_CA}" ]; then
cp "$CUSTOM_CA" /usr/share/pki/ca-trust-source/anchors/custom-ca.pem cp "$CUSTOM_CA" /usr/share/pki/ca-trust-source/anchors/custom-ca.pem
...@@ -150,7 +162,7 @@ check-semantic-version: ...@@ -150,7 +162,7 @@ check-semantic-version:
stage: build stage: build
image: quay.io/containers/buildah:v1.38.1 image: quay.io/containers/buildah:v1.38.1
before_script: before_script:
- *install-custom-ca - *install-custom-ca-fedora
# Supporting GitLab dependency proxies: # Supporting GitLab dependency proxies:
# see https://docs.gitlab.com/ee/user/packages/dependency_proxy/ # see https://docs.gitlab.com/ee/user/packages/dependency_proxy/
- | - |
...@@ -264,7 +276,7 @@ shellcheck: ...@@ -264,7 +276,7 @@ shellcheck:
variables: variables:
GITLAB_OPENTOFU_BASE_IMAGE_OS: $RELEASE_BASE_IMAGE_OS GITLAB_OPENTOFU_BASE_IMAGE_OS: $RELEASE_BASE_IMAGE_OS
before_script: before_script:
- *install-custom-ca - *install-custom-ca-alpine
- *image-matrix-deploy-release-name-script - *image-matrix-deploy-release-name-script
- crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- 'echo "base image OS: $GITLAB_OPENTOFU_BASE_IMAGE_OS"' - 'echo "base image OS: $GITLAB_OPENTOFU_BASE_IMAGE_OS"'
...@@ -354,7 +366,7 @@ gitlab-opentofu-image:verify-signature: ...@@ -354,7 +366,7 @@ gitlab-opentofu-image:verify-signature:
name: alpine/crane:0.20.3 name: alpine/crane:0.20.3
entrypoint: [""] entrypoint: [""]
before_script: before_script:
- *install-custom-ca - *install-custom-ca-alpine
- *image-matrix-deploy-release-name-script - *image-matrix-deploy-release-name-script
- apk add --update cosign - apk add --update cosign
script: script:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment