Skip to content

Commit 95c9b6d

Browse files
committed
chore(ci): add automatic GitLab image pushes
1 parent e45a6e2 commit 95c9b6d

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

.gitlab-ci.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ black_lint:
2626
except:
2727
- master
2828

29-
#build_test_image: # Currently hangs forever, because of GitLab Runner infrastructure issues
30-
# stage: build-test-image
31-
# image:
32-
# name: gcr.io/kaniko-project/executor:debug
33-
# entrypoint: [""]
34-
# script:
35-
# - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
36-
# - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/tools/Dockerfile-test --destination $CI_REGISTRY_IMAGE:test
37-
# only:
38-
# refs:
39-
# - master
40-
# changes:
41-
# - tools/
29+
build_test_image:
30+
stage: build-test-image
31+
image:
32+
name: gcr.io/kaniko-project/executor:debug
33+
entrypoint: [""]
34+
script:
35+
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
36+
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/tools/Dockerfile-test --destination $CI_REGISTRY_IMAGE:test
37+
only:
38+
refs:
39+
- master
40+
changes:
41+
- tools/
4242

4343
.tox_includes: &tox_includes
4444
stage: test
@@ -103,3 +103,14 @@ deploy:
103103
- twine upload --skip-existing -u $TWINE_USERNAME -p $TWINE_PASSWORD dist/*
104104
only:
105105
- tags
106+
107+
deploy_image:
108+
stage: deploy
109+
image:
110+
name: gcr.io/kaniko-project/executor:debug
111+
entrypoint: [""]
112+
script:
113+
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
114+
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
115+
only:
116+
- tags

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ How to use
5555

5656
``docker run -it --rm -e GITLAB_PRIVATE_TOKEN=<your token> -v /path/to/python-gitlab.cfg:/python-gitlab.cfg python-gitlab <command> ...``
5757

58-
To change the GitLab URL, use `-e GITLAB_URL=<your url>`
58+
or run it directly from the upstream image:
59+
60+
``docker run -it --rm -e GITLAB_PRIVATE_TOKEN=<your token> -v /path/to/python-gitlab.cfg:/python-gitlab.cfg registry.gitlab.com/python-gitlab/python-gitlab:v1.8.0 <command> ...``
5961

62+
To change the GitLab URL, use `-e GITLAB_URL=<your url>`
6063

6164
Bring your own config file:
6265
``docker run -it --rm -v /path/to/python-gitlab.cfg:/python-gitlab.cfg -e GITLAB_CFG=/python-gitlab.cfg python-gitlab <command> ...``

tools/Dockerfile-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN apt-get update \
1111
tzdata \
1212
&& curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash \
1313
&& apt-get install -qy --no-install-recommends \
14-
gitlab-ce=11.10.0-ce.0
14+
gitlab-ce=11.11.2-ce.0
1515

1616
# Manage SSHD through runit
1717
RUN mkdir -p /opt/gitlab/sv/sshd/supervise \

tools/build_test_env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ cleanup() {
7777
}
7878

7979
try docker run --name gitlab-test --detach --publish 8080:80 \
80-
--publish 2222:22 pythongitlab/test-python-gitlab:latest >/dev/null
80+
--publish 2222:22 registry.gitlab.com/python-gitlab/python-gitlab:test >/dev/null
8181

8282
LOGIN='root'
8383
PASSWORD='5iveL!fe'

0 commit comments

Comments
 (0)