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

Merge branch 'build-job-runner-tag' into 'main'

Support custom runner tag for image build job

Closes #73

See merge request components/opentofu!183
parents c11f0ebe cfbc9d79
Branches
Tags
No related merge requests found
...@@ -116,7 +116,18 @@ check-semantic-version: ...@@ -116,7 +116,18 @@ check-semantic-version:
script: script:
- echo -n "$CI_COMMIT_TAG" | ./.gitlab/scripts/check-semantic-version.sh - echo -n "$CI_COMMIT_TAG" | ./.gitlab/scripts/check-semantic-version.sh
gitlab-opentofu-image:build: .gitlab-opentofu-image:build:base:rules: &gitlab-opentofu-image-build-base-rules
- if: $CI_COMMIT_TAG
- changes:
- Dockerfile.*
- .dockerignore
- opentofu_versions.yaml
- .gitlab-ci.yml
- src/**/*
- templates/**/*
- tests/**/*
.gitlab-opentofu-image:build:base:
extends: '.image-matrix:build' extends: '.image-matrix:build'
stage: build stage: build
image: quay.io/containers/buildah:v1.37.5 image: quay.io/containers/buildah:v1.37.5
...@@ -149,16 +160,22 @@ gitlab-opentofu-image:build: ...@@ -149,16 +160,22 @@ gitlab-opentofu-image:build:
--manifest "$GITLAB_OPENTOFU_IMAGE_NAME" --manifest "$GITLAB_OPENTOFU_IMAGE_NAME"
. .
- buildah manifest push --all "$GITLAB_OPENTOFU_IMAGE_NAME" - buildah manifest push --all "$GITLAB_OPENTOFU_IMAGE_NAME"
gitlab-opentofu-image:build:
extends: '.gitlab-opentofu-image:build:base'
rules: rules:
- if: $CI_COMMIT_TAG - if: $OPENTOFU_COMPONENT_IMAGE_BUILD_RUNNER_TAG
- changes: when: never
- Dockerfile.* - *gitlab-opentofu-image-build-base-rules
- .dockerignore
- opentofu_versions.yaml gitlab-opentofu-image:build:custom-runner:
- .gitlab-ci.yml extends: '.gitlab-opentofu-image:build:base'
- src/**/* tags:
- templates/**/* - $OPENTOFU_COMPONENT_IMAGE_BUILD_RUNNER_TAG
- tests/**/* rules:
- if: '$OPENTOFU_COMPONENT_IMAGE_BUILD_RUNNER_TAG == null || $OPENTOFU_COMPONENT_IMAGE_BUILD_RUNNER_TAG == ""'
when: never
- *gitlab-opentofu-image-build-base-rules
check-versions: check-versions:
stage: test stage: test
...@@ -237,7 +254,11 @@ gitlab-opentofu-image:deploy: ...@@ -237,7 +254,11 @@ gitlab-opentofu-image:deploy:
gitlab-opentofu-image:deploy:dry-run: gitlab-opentofu-image:deploy:dry-run:
extends: ['.gitlab-opentofu-image:deploy:base'] extends: ['.gitlab-opentofu-image:deploy:base']
needs: ['gitlab-opentofu-image:build'] needs:
- job: 'gitlab-opentofu-image:build'
optional: true
- job: 'gitlab-opentofu-image:build:custom-runner'
optional: true
script: script:
- echo "dry run" - echo "dry run"
rules: rules:
......
...@@ -457,6 +457,9 @@ See also the official GitLab documentation for it ...@@ -457,6 +457,9 @@ 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`.
You can set the `OPENTOFU_COMPONENT_IMAGE_BUILD_RUNNER_TAG` CI/CD variable to a custom runner tag
to use for the image build job. This may be useful if you require a dedicated privileged runner.
The pipeline of this component respects the The pipeline of this component respects the
[GitLab Dependency Proxy](https://docs.gitlab.com/ee/user/packages/dependency_proxy/) configuration [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 by detecting the `CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX` environment variable
......
...@@ -472,6 +472,9 @@ See also the official GitLab documentation for it ...@@ -472,6 +472,9 @@ 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`.
You can set the `OPENTOFU_COMPONENT_IMAGE_BUILD_RUNNER_TAG` CI/CD variable to a custom runner tag
to use for the image build job. This may be useful if you require a dedicated privileged runner.
The pipeline of this component respects the The pipeline of this component respects the
[GitLab Dependency Proxy](https://docs.gitlab.com/ee/user/packages/dependency_proxy/) configuration [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 by detecting the `CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX` environment variable
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment