Skip to content
Snippets Groups Projects
Unverified Commit 6bd8a73f authored by Timo Furrer's avatar Timo Furrer
Browse files

Support GitLab dependency proxy when building gitlab-tofu images

parent a5b1b23e
No related branches found
No related tags found
No related merge requests found
...@@ -89,6 +89,20 @@ gitlab-opentofu-image:build: ...@@ -89,6 +89,20 @@ gitlab-opentofu-image:build:
stage: build stage: build
image: quay.io/containers/buildah:v1.37.3 image: quay.io/containers/buildah:v1.37.3
before_script: before_script:
# Supporting GitLab dependency proxies:
# see https://docs.gitlab.com/ee/user/packages/dependency_proxy/
- |
if [ -n "$CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX" ]; then
echo "Detected GitLab Dependency Proxy at '$CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX', configuring it for buildah ..."
cat > /etc/containers/registries.conf.d/dependency-proxy.conf <<EOF
[[registry]]
location = "docker.io"
[[registry.mirror]]
location = "${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}"
EOF
buildah login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" "$CI_DEPENDENCY_PROXY_SERVER"
fi
- buildah login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - buildah login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
script: script:
- echo "Building $GITLAB_OPENTOFU_IMAGE_NAME" - echo "Building $GITLAB_OPENTOFU_IMAGE_NAME"
......
...@@ -396,6 +396,11 @@ See also the official GitLab documentation for it ...@@ -396,6 +396,11 @@ See also the official GitLab documentation for it
If you want to save runner resources you may disable the unit and integration tests If you want to save runner resources you may disable the unit and integration tests
by setting the `SKIP_TESTS` CI/CD variable to `true`. by setting the `SKIP_TESTS` CI/CD variable to `true`.
The pipeline of this component respects the
[GitLab Dependency Proxy](https://docs.gitlab.com/ee/user/packages/dependency_proxy/) configuration
by detecting the `CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX` environment variable
and configuring `buildah` to use it when building the container images.
## Migrating from the Terraform CI/CD templates ## Migrating from the Terraform CI/CD templates
When migrating from the GitLab Terraform CI/CD templates you can use the following migration rules: When migrating from the GitLab Terraform CI/CD templates you can use the following migration rules:
......
...@@ -415,6 +415,11 @@ See also the official GitLab documentation for it ...@@ -415,6 +415,11 @@ See also the official GitLab documentation for it
If you want to save runner resources you may disable the unit and integration tests If you want to save runner resources you may disable the unit and integration tests
by setting the `SKIP_TESTS` CI/CD variable to `true`. by setting the `SKIP_TESTS` CI/CD variable to `true`.
The pipeline of this component respects the
[GitLab Dependency Proxy](https://docs.gitlab.com/ee/user/packages/dependency_proxy/) configuration
by detecting the `CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX` environment variable
and configuring `buildah` to use it when building the container images.
## Migrating from the Terraform CI/CD templates ## Migrating from the Terraform CI/CD templates
When migrating from the GitLab Terraform CI/CD templates you can use the following migration rules: When migrating from the GitLab Terraform CI/CD templates you can use the following migration rules:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment