gitlab CI: use a template for the various ci-fairy jobs
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 10 Nov 2020 23:13:20 +0000 (09:13 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 11 Nov 2020 23:31:37 +0000 (09:31 +1000)
And switch to python:alpine, an image that is tiny and sufficient for the job
we want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
.gitlab-ci.yml
.gitlab-ci/ci.template

index e4e40fb19bdcd116ef1c79accd67efdce2542025..3f3bbb706c5ab155a2d4a657c172eb38c0e5f2fc 100644 (file)
@@ -123,6 +123,13 @@ variables:
     reports:
       junit: $MESON_BUILDDIR/junit-*.xml
 
+
+.ci_fairy_image:
+  image: python:alpine
+  before_script:
+    - apk add git
+    - pip install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
+
 #################################################################
 #                                                               #
 #                          prep stage                           #
@@ -134,11 +141,9 @@ variables:
 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
 #
 check-ci-script:
-  image: golang:alpine
+  extends:
+    - .ci_fairy_image
   stage: prep
-  before_script:
-    - apk add python3 py-pip git
-    - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
   script:
     - ci-fairy generate-template
     - git diff --exit-code && exit 0 || true
@@ -150,11 +155,9 @@ check-ci-script:
 #
 
 check-commit:
-  image: golang:alpine
+  extends:
+    - .ci_fairy_image
   stage: prep
-  before_script:
-    - apk add python3 py-pip git
-    - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
   script:
     - ci-fairy check-commits --signed-off-by --junit-xml=results.xml
   except:
@@ -170,11 +173,9 @@ check-commit:
 #
 
 check-merge-request:
-  image: golang:alpine
+  extends:
+    - .ci_fairy_image
   stage: deploy
-  before_script:
-    - apk add python3 py-pip git
-    - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
   script:
     - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
   artifacts:
@@ -322,13 +323,10 @@ freebsd:11.2@container-prep:
 # $container_image:$tag
 #
 .container-clean:
-  stage: container_clean
   extends:
     - .policy
-  image: golang:alpine
-  before_script:
-    - apk add python3 py-pip git
-    - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
+    - .ci_fairy_image
+  stage: container_clean
   script:
     # Go to your Profile, Settings, Access Tokens
     # Create a personal token with 'api' scope, copy the value.
index 6231206775a540681cbc2e7e8e78d13b06e999e7..7223b412a237f00466ad95fe7235110e269edf80 100644 (file)
@@ -119,6 +119,13 @@ variables:
     reports:
       junit: $MESON_BUILDDIR/junit-*.xml
 
+
+.ci_fairy_image:
+  image: python:alpine
+  before_script:
+    - apk add git
+    - pip install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
+
 #################################################################
 #                                                               #
 #                          prep stage                           #
@@ -130,11 +137,9 @@ variables:
 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
 #
 check-ci-script:
-  image: golang:alpine
+  extends:
+    - .ci_fairy_image
   stage: prep
-  before_script:
-    - apk add python3 py-pip git
-    - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
   script:
     - ci-fairy generate-template
     - git diff --exit-code && exit 0 || true
@@ -146,11 +151,9 @@ check-ci-script:
 #
 
 check-commit:
-  image: golang:alpine
+  extends:
+    - .ci_fairy_image
   stage: prep
-  before_script:
-    - apk add python3 py-pip git
-    - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
   script:
     - ci-fairy check-commits --signed-off-by --junit-xml=results.xml
   except:
@@ -166,11 +169,9 @@ check-commit:
 #
 
 check-merge-request:
-  image: golang:alpine
+  extends:
+    - .ci_fairy_image
   stage: deploy
-  before_script:
-    - apk add python3 py-pip git
-    - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
   script:
     - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
   artifacts:
@@ -285,13 +286,10 @@ freebsd:11.2@container-prep:
 # $container_image:$tag
 #
 .container-clean:
-  stage: container_clean
   extends:
     - .policy
-  image: golang:alpine
-  before_script:
-    - apk add python3 py-pip git
-    - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
+    - .ci_fairy_image
+  stage: container_clean
   script:
     # Go to your Profile, Settings, Access Tokens
     # Create a personal token with 'api' scope, copy the value.