diff --git a/gitlab-runner-18.1.yaml b/gitlab-runner-18.1.yaml new file mode 100644 index 00000000000..cd894e850d4 --- /dev/null +++ b/gitlab-runner-18.1.yaml @@ -0,0 +1,169 @@ +vars: + # GitLab Base Images tags: https://gitlab.com/gitlab-org/ci-cd/runner-tools/base-images/-/tags + base-images-tag: 0.0.18 + base-images-commit: ebc214086a29dbdfefef35274037922f8707ad26 + # Docker Machine tags: https://gitlab.com/gitlab-org/ci-cd/docker-machine/-/tags + docker-machine-tag: v0.16.2-gitlab.37 + docker-machine-commit: 04d824cdca5633239ec0df4a7b8bdc975ca7e6cf + +var-transforms: + - from: ${{package.version}} + match: ^(\d+\.\d+)\.\d+$ + replace: "$1" + to: major-minor-version + +package: + name: gitlab-runner-18.1 + # ---Additional updates required--- Review 'vars' section (above), when reviewing version bumps. + version: "18.1.0" + epoch: 0 + description: GitLab Runner is the open source project that is used to run your CI/CD jobs and send the results back to GitLab + copyright: + - license: MIT + dependencies: + provides: + - gitlab-runner=${{package.full-version}} + +pipeline: + - uses: git-checkout + with: + repository: https://gitlab.com/gitlab-org/gitlab-runner + tag: v${{package.version}} + expected-commit: 0731d300775d6114bb4b5ffffc9f0f0af0005d37 + + - name: Verify base-images-tag matches the expected upstream value + runs: | + # Ensure the expected tag used of the base images align with upstream. + # Each GitLab Runner version depends on a specific base image version. + # We manually verify that `base-images-tag` matches the expected upstream value + # defined in the corresponding GitLab Runner configuration: + # https://gitlab.com/gitlab-org/gitlab-runner/-/blob/v${{package.version}}/.gitlab/ci/_common.gitlab-ci.yml + # (variable: RUNNER_IMAGES_VERSION) + + BASE_IMAGES_TAG=$(cat ./.gitlab/ci/_common.gitlab-ci.yml | sed -n 's/.*RUNNER_IMAGES_VERSION: "\([0-9.]*\)".*/\1/p') + + if [ "${{vars.base-images-tag}}" != "${BASE_IMAGES_TAG}" ]; then + echo "Expected BASE_IMAGES_TAG: ${{vars.base-images-tag}} but got: $BASE_IMAGES_TAG" + exit 1 + fi + + - uses: git-checkout + with: + repository: https://gitlab.com/gitlab-org/ci-cd/runner-tools/base-images + tag: v${{vars.base-images-tag}} + expected-commit: ${{vars.base-images-commit}} + destination: ./base-images + + - name: Verify docker-machine-tag matches the expected value + runs: | + # Ensure the expected tag used of the docker machine align with upstream base images. + # The version used by the upstream can be found in the following file: + # https://gitlab.com/gitlab-org/ci-cd/runner-tools/base-images/-/blob/v${{vars.base-images-tag}}/dockerfiles/runner/docker-bake.hcl + # (as: DOCKER_MACHINE_VERSION) + + DOCKER_MACHINE_VERSION=$(sed -n 's/.*DOCKER_MACHINE_VERSION *= *"\([^"]*\)".*/\1/p' ./base-images/dockerfiles/runner/docker-bake.hcl) + + if [ "${{vars.docker-machine-tag}}" != "${DOCKER_MACHINE_VERSION}" ]; then + echo "Expected DOCKER_MACHINE_VERSION: ${{vars.docker-machine-tag}} but got: $DOCKER_MACHINE_VERSION" + exit 1 + fi + + - uses: git-checkout + with: + repository: https://gitlab.com/gitlab-org/ci-cd/docker-machine + tag: ${{vars.docker-machine-tag}} + expected-commit: ${{vars.docker-machine-commit}} + destination: ./machine + + - uses: go/build + with: + packages: . + output: gitlab-runner + ldflags: -w -X gitlab.com/gitlab-org/gitlab-runner/common.NAME=${{package.name}} -X gitlab.com/gitlab-org/gitlab-runner/common.VERSION=v${{package.version}} + +subpackages: + - name: gitlab-runner-helper-${{vars.major-minor-version}} + description: GitLab Runner Helper + dependencies: + provides: + - gitlab-runner-helper=${{package.full-version}} + pipeline: + - uses: go/build + with: + packages: ./apps/gitlab-runner-helper + output: gitlab-runner-helper + ldflags: -w -X gitlab.com/gitlab-org/gitlab-runner/common.NAME=${{package.name}} -X gitlab.com/gitlab-org/gitlab-runner/common.VERSION=v${{package.version}} + + - name: "gitlab-runner-oci-entrypoint-${{vars.major-minor-version}}" + description: "Gitlab-runner oci entrypoint" + dependencies: + provides: + - gitlab-runner-oci-entrypoint=${{package.full-version}} + pipeline: + - runs: | + mkdir -p "${{targets.subpkgdir}}" + cp ./base-images/dockerfiles/runner/alpine/entrypoint "${{targets.subpkgdir}}"/entrypoint + chmod 755 "${{targets.subpkgdir}}"/entrypoint + + # As of 17.8, the entrypoint is now sourced from yet another repository + - name: "gitlab-runner-helper-oci-entrypoint-${{vars.major-minor-version}}" + description: "Gitlab-runner-helper oci entrypoint" + dependencies: + provides: + - gitlab-runner-helper-oci-entrypoint=${{package.full-version}} + pipeline: + - runs: | + mkdir -p "${{targets.subpkgdir}}"/usr/bin + cp ./base-images/dockerfiles/runner-helper/scripts/gitlab-runner-build "${{targets.subpkgdir}}"/usr/bin/gitlab-runner-build + cp ./base-images/dockerfiles/runner-helper/helpers/entrypoint "${{targets.subpkgdir}}"/entrypoint + + - name: "gitlab-runner-helper-compat-${{vars.major-minor-version}}" + description: "Gitlab-runner-helper compat" + dependencies: + provides: + - gitlab-runner-helper-compat=${{package.full-version}} + pipeline: + - runs: | + mkdir -p "${{targets.subpkgdir}}"/usr/bin + ln -sf /usr/bin/gitlab-runner "${{targets.subpkgdir}}"/usr/bin/gitlab-ci-multi-runner + ln -sf /usr/bin/miniperl "${{targets.subpkgdir}}"/usr/bin/perl + + - name: gitlab-docker-machine-${{vars.major-minor-version}} + description: "Creates Docker hosts used by GitLab runner." + dependencies: + provides: + - gitlab-docker-machine=${{package.full-version}} + pipeline: + - uses: go/bump + with: + deps: |- + golang.org/x/oauth2@v0.27.0 + modroot: ./machine + - uses: go/build + with: + packages: ./cmd/docker-machine + output: docker-machine + ldflags: -w -X github.com/docker/machine/version.GitCommit=$(git rev-parse --short HEAD 2>/dev/null) + modroot: ./machine + test: + pipeline: + - runs: | + DOCKER_MACHINE_VERSION=$(echo ${{vars.docker-machine-tag}} | sed 's/^v//') + docker-machine -v | grep $DOCKER_MACHINE_VERSION + docker-machine -h + +update: + enabled: true + git: + strip-prefix: v + tag-filter-prefix: v18.1 + +test: + environment: + contents: + packages: + - gitlab-runner-helper=${{package.full-version}} + pipeline: + - runs: | + gitlab-runner --help + gitlab-runner-helper --help