Skip to content

Commit 94b4d37

Browse files
committed
gitlab-ci to create container image for usage in gitlab-ci
See: https://docs.gitlab.com/ee/ci/testing/code_quality.html#required-images Signed-off-by: Matthias Blümel <[email protected]>
1 parent 0c08691 commit 94b4d37

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.gitlab-ci.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
image-build:
2+
image:
3+
name: quay.io/buildah/stable:latest
4+
stage: build
5+
before_script:
6+
- 'echo "$CI_REGISTRY_PASSWORD" | buildah login --username "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY'
7+
script:
8+
# more than two levels are forbidden -> using `-cache` instead of `/cache`
9+
# https://docs.gitlab.com/ee/user/packages/container_registry/#naming-convention-for-your-container-images
10+
- buildah bud
11+
-f "Containerfile"
12+
-t "$CI_REGISTRY_IMAGE/codeclimate/codeclimate-openapi:latest"
13+
--layers
14+
--cache-from=$CI_REGISTRY_IMAGE/codeclimate/codeclimate-openapi-cache
15+
--cache-to=$CI_REGISTRY_IMAGE/codeclimate/codeclimate-openapi-cache
16+
.
17+
- buildah push "$CI_REGISTRY_IMAGE/codeclimate/codeclimate-openapi:latest"
18+
19+
copy-upstream:
20+
stage: deploy
21+
image:
22+
name: quay.io/skopeo/stable:latest
23+
entrypoint: [""]
24+
before_script:
25+
- 'echo "$CI_REGISTRY_PASSWORD" | skopeo login --username "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY'
26+
script:
27+
- 'skopeo copy "docker://docker.io/${image_name}" "docker://$CI_REGISTRY_IMAGE/${image_name}"'
28+
parallel:
29+
matrix:
30+
- image_name:
31+
- codeclimate/codeclimate:0.94.0
32+
- codeclimate/codeclimate:0.96.0
33+
- codeclimate/codeclimate:latest
34+
- codeclimate/codeclimate-structure:latest
35+
- codeclimate/codeclimate-csslint:latest
36+
- codeclimate/codeclimate-coffeelint:latest
37+
- codeclimate/codeclimate-duplication:latest
38+
- codeclimate/codeclimate-eslint:latest
39+
- codeclimate/codeclimate-fixme:latest
40+
- codeclimate/codeclimate-rubocop:latest
41+
rules:
42+
- if: $CI_PIPELINE_SOURCE == "schedule"

0 commit comments

Comments
 (0)