From 94b4d37e40b64e6390507f03b0c9ebc0f7ac0bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bl=C3=BCmel?= Date: Wed, 24 May 2023 23:31:12 +0200 Subject: [PATCH] gitlab-ci to create container image for usage in gitlab-ci MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See: https://docs.gitlab.com/ee/ci/testing/code_quality.html#required-images Signed-off-by: Matthias Blümel --- .gitlab-ci.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..0e24920cf --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,42 @@ +image-build: + image: + name: quay.io/buildah/stable:latest + stage: build + before_script: + - 'echo "$CI_REGISTRY_PASSWORD" | buildah login --username "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY' + script: + # more than two levels are forbidden -> using `-cache` instead of `/cache` + # https://docs.gitlab.com/ee/user/packages/container_registry/#naming-convention-for-your-container-images + - buildah bud + -f "Containerfile" + -t "$CI_REGISTRY_IMAGE/codeclimate/codeclimate-openapi:latest" + --layers + --cache-from=$CI_REGISTRY_IMAGE/codeclimate/codeclimate-openapi-cache + --cache-to=$CI_REGISTRY_IMAGE/codeclimate/codeclimate-openapi-cache + . + - buildah push "$CI_REGISTRY_IMAGE/codeclimate/codeclimate-openapi:latest" + +copy-upstream: + stage: deploy + image: + name: quay.io/skopeo/stable:latest + entrypoint: [""] + before_script: + - 'echo "$CI_REGISTRY_PASSWORD" | skopeo login --username "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY' + script: + - 'skopeo copy "docker://docker.io/${image_name}" "docker://$CI_REGISTRY_IMAGE/${image_name}"' + parallel: + matrix: + - image_name: + - codeclimate/codeclimate:0.94.0 + - codeclimate/codeclimate:0.96.0 + - codeclimate/codeclimate:latest + - codeclimate/codeclimate-structure:latest + - codeclimate/codeclimate-csslint:latest + - codeclimate/codeclimate-coffeelint:latest + - codeclimate/codeclimate-duplication:latest + - codeclimate/codeclimate-eslint:latest + - codeclimate/codeclimate-fixme:latest + - codeclimate/codeclimate-rubocop:latest + rules: + - if: $CI_PIPELINE_SOURCE == "schedule"