.gitlab-ci.yml: split out samba-{def,mit}-build into the build_first stage
authorStefan Metzmacher <metze@samba.org>
Fri, 20 Nov 2020 11:25:33 +0000 (12:25 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 13 Apr 2021 08:23:35 +0000 (08:23 +0000)
It's enough to have 2 jobs in build_first, so we can move 'samba-fips'
out of it again.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
.gitlab-ci.yml

index bdf0f853336ae1484799de2b8d6ce2c886a2ae76..92a49c63fcbc2b15ecc35a8f853b6382301ed58a 100644 (file)
@@ -96,6 +96,7 @@ include:
     - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
     - diff -u bootstrap/sha1sum.txt /sha1sum.txt
+    - echo "${CI_COMMIT_SHA} ${CI_COMMIT_TITLE}" > /tmp/commit.txt
     - export CCACHE_BASEDIR="${PWD}"
     - export CCACHE_DIR="${PWD}/ccache" && mkdir -pv "$CCACHE_DIR"
     - export CC="ccache cc"
@@ -141,6 +142,71 @@ others:
     - script/autobuild.py samba-xc $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/samba-xc
     - script/autobuild.py docs-xml $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase/docs-xml
 
+.shared_template_build_only:
+  extends: .shared_template
+  stage: build_first
+  artifacts:
+    expire_in: 1 week
+    paths:
+      - "*.stdout"
+      - "*.stderr"
+      - "*.info"
+      - system-info.txt
+      - samba-testbase.tar.gz
+  script:
+    # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
+    # autobuild name, which means we can define a default template that runs most autobuild jobs
+    - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE  --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
+    # On success we need to pack everything into an artifacts file
+    # which needs to be in the git checkout.
+    # As tar doesn't handle hardlink of read-only files,
+    # we remember the acls and add write permissions
+    # before creating the archive. The consumer will apply
+    # the acls again.
+    - cp -a /sha1sum.txt /tmp/samba-testbase/image-sha1sum.txt
+    - cp -a /tmp/commit.txt /tmp/samba-testbase/commit.txt
+    - pushd /tmp && getfacl -R samba-testbase > samba-testbase.acl.dump && popd
+    - chmod -R +w /tmp/samba-testbase
+    - mv /tmp/samba-testbase.acl.dump /tmp/samba-testbase/
+    - tar cfz samba-testbase.tar.gz /tmp/samba-testbase
+    - ls -la samba-testbase.tar.gz
+    - sha1sum samba-testbase.tar.gz
+
+.shared_template_test_only:
+  extends: .shared_template
+  stage: build
+  script:
+    # We unpack the artifacts file created by the .shared_template_build_only
+    # run we depend on
+    - ls -la samba-testbase.tar.gz
+    - sha1sum samba-testbase.tar.gz
+    - tar xfz samba-testbase.tar.gz -C /
+    - diff -u /tmp/samba-testbase/image-sha1sum.txt /sha1sum.txt
+    - diff -u /tmp/samba-testbase/commit.txt /tmp/commit.txt
+    - mv /tmp/samba-testbase/samba-testbase.acl.dump /tmp/samba-testbase.acl.dump
+    - pushd /tmp && setfacl --restore=/tmp/samba-testbase.acl.dump && popd
+    # gitlab predefines CI_JOB_NAME for each job. The gitlab job usually matches the
+    # autobuild name, which means we can define a default template that runs most autobuild jobs
+    - script/autobuild.py $AUTOBUILD_JOB_NAME $SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE --skip-dependencies --verbose --nocleanup --keeplogs --tail --full-testbase /tmp/samba-testbase
+
+samba-def-build:
+  extends: .shared_template_build_only
+
+.needs_samba-def-build:
+  extends: .shared_template_test_only
+  needs:
+    - job: samba-def-build
+      artifacts: true
+
+samba-mit-build:
+  extends: .shared_template_build_only
+
+.needs_samba-mit-build:
+  extends: .shared_template_test_only
+  needs:
+    - job: samba-mit-build
+      artifacts: true
+
 samba:
   extends: .shared_template
 
@@ -151,22 +217,22 @@ samba-minimal-smbd:
   extends: .shared_template
 
 samba-admem:
-  extends: .shared_template
+  extends: .needs_samba-def-build
 
 samba-ad-dc-2:
-  extends: .shared_template
+  extends: .needs_samba-def-build
 
 samba-ad-dc-3:
-  extends: .shared_template
+  extends: .needs_samba-def-build
 
 samba-ad-dc-4:
-  extends: .shared_template
+  extends: .needs_samba-def-build
 
 samba-ad-dc-5:
-  extends: .shared_template
+  extends: .needs_samba-def-build
 
 samba-ad-dc-6:
-  extends: .shared_template
+  extends: .needs_samba-def-build
 
 samba-libs:
   extends: .shared_template
@@ -182,18 +248,17 @@ samba-ctdb:
   extends: .shared_template
 
 samba-ad-dc-ntvfs:
-  extends: .shared_template
+  extends: .needs_samba-def-build
 
 samba-admem-mit:
-  extends: .shared_template
+  extends: .needs_samba-mit-build
 
 samba-ad-dc-4-mitkrb5:
-  extends: .shared_template
+  extends: .needs_samba-mit-build
 
 # This task is run first to ensure we compile before we start the
 # main run as it is the fastest full compile of Samba.
 samba-fips:
-  stage: build_first
   extends: .shared_template
   image: $SAMBA_CI_CONTAINER_IMAGE_fedora33