[6.6] 2376a2a09 Change the dist job to be build or download

Martin Blix Grydeland martin at varnish-software.com
Thu Mar 18 12:01:06 UTC 2021


commit 2376a2a09b07f85eb191da730346bc746e26e407
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Mar 17 15:53:18 2021 +0100

    Change the dist job to be build or download
    
    Varnish packages are always built using a release tarball. This change
    enables sending build URL for tarball to be downloaded from and SHA256 sum
    to validate against as build parameters.
    
    If a specific commit is used and the tarball is created for the build
    step, the .is_weekly flag file will always be set, causing the packages to
    be dated.

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 09d0f2db1..5cfc6686c 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -13,9 +13,16 @@ parameters:
   pkg-commit:
     type: string
     default: "master"
+  dist-url:
+    type: string
+    default: ""
+  dist-url-sha256:
+    type: string
+    default: ""
+
 jobs:
   dist:
-    description: Builds varnish-x.y.z.tar.gz that is used later for the packaging jobs
+    description: Build or download varnish-x.y.z.tar.gz that is used later for the packaging jobs
     docker:
       - image: centos:7
     steps:
@@ -33,19 +40,43 @@ jobs:
                 make \
                 pcre-devel \
                 python3 \
-                python-sphinx
+                python-sphinx \
+                curl
       - checkout
-      - run:
-          name: Create the dist tarball
-          command: |
-            git checkout << pipeline.parameters.vc-commit >>
-            # if version is "trunk", it's a weekly tarball, override the version
-            if grep 'AC_INIT.*trunk.*' ./configure.ac; then
-                sed -i -e "s/^AC_INIT.*trunk.*/AC_INIT([Varnish], [$(date +%Y%m%d)], [varnish-dev at varnish-cache.org])/" ./configure.ac
-                touch .is_weekly
-            fi
-            ./autogen.des --quiet
-            make dist -j 16
+      - when:
+          condition: << pipeline.parameters.dist-url >>
+          steps:
+            - run:
+                name: Download the dist tarball
+                command: |
+                  curl -s << pipeline.parameters.dist-url >> -o varnish-dist.tar.gz
+            - when:
+                condition: << pipeline.parameters.dist-url-sha256 >>
+                steps:
+                    - run:
+                        name: Verify downloaded tarball
+                        command: |
+                          echo "<< pipeline.parameters.dist-url-sha256 >> varnish-dist.tar.gz" | sha256sum -c
+            - run:
+                name: Rename the dist tarball by parsed version
+                command: |
+                  mkdir parse-version-tmp
+                  cd parse-version-tmp
+                  tar xzf ../varnish-dist.tar.gz
+                  VERSION=$(varnish-*/configure --version | awk 'NR == 1 {print $NF}')
+                  cd ..
+                  mv -v varnish-dist.tar.gz varnish-${VERSION}.tar.gz
+      - unless:
+          condition: << pipeline.parameters.dist-url >>
+          steps:
+            - run:
+                name: Create the dist tarball
+                command: |
+                  git checkout << pipeline.parameters.vc-commit >>
+                  # Locally built tarballs are always weekly - built with date in package name
+                  touch .is_weekly
+                  ./autogen.des --quiet
+                  make dist -j 16
       - persist_to_workspace:
           root: .
           paths:


More information about the varnish-commit mailing list