Changeset 41f03b7


Ignore:
Timestamp:
02/07/19 11:52:58 (21 months ago)
Author:
Brad Cowie <brad@…>
Children:
90709c5
Parents:
e4e33e9
Message:

Improve gitlab ci builds.

  • Build on Ubuntu Cosmic.
  • Stop building on Debian Buster/Sid? & Ubuntu Artful.
  • Automatically upload packages to bintray.
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • .gitlab-ci.yml

    reeea305 r41f03b7  
    11stages:
    22  - build
    3   - deploy
    43  - upload
    54
    6 build-debian-jessie:
     5build-amd64-debian-jessie:
    76  stage: build
    87  image: debian:jessie
    98  script:
    109    - ./gitlab-build.sh
    11     - mkdir -p built-packages/debian_jessie/
    12     - mv ../*.deb built-packages/debian_jessie/
     10    - mkdir -p built-packages/amd64/debian_jessie/
     11    - mv ../*.deb built-packages/amd64/debian_jessie/
    1312  artifacts:
    1413    paths:
     
    1817    - tags
    1918
    20 build-debian-stretch:
     19build-amd64-debian-stretch:
    2120  stage: build
    2221  image: debian:stretch
    2322  script:
    2423    - ./gitlab-build.sh
    25     - mkdir -p built-packages/debian_stretch/
    26     - mv ../*.deb built-packages/debian_stretch/
     24    - mkdir -p built-packages/amd64/debian_stretch/
     25    - mv ../*.deb built-packages/amd64/debian_stretch/
    2726  artifacts:
    2827    paths:
     
    3231    - tags
    3332
    34 build-debian-buster:
     33build-amd64-ubuntu-xenial:
    3534  stage: build
    36   image: debian:buster
     35  image: ubuntu:xenial
    3736  script:
    3837    - ./gitlab-build.sh
    39     - mkdir -p built-packages/debian_buster/
    40     - mv ../*.deb built-packages/debian_buster/
     38    - mkdir -p built-packages/amd64/ubuntu_xenial/
     39    - mv ../*.deb built-packages/amd64/ubuntu_xenial/
    4140  artifacts:
    4241    paths:
     
    4645    - tags
    4746
    48 build-debian-sid:
     47build-amd64-ubuntu-bionic:
    4948  stage: build
    50   image: debian:sid
     49  image: ubuntu:bionic
    5150  script:
    5251    - ./gitlab-build.sh
    53     - mkdir -p built-packages/debian_sid/
    54     - mv ../*.deb built-packages/debian_sid/
     52    - mkdir -p built-packages/amd64/ubuntu_bionic/
     53    - mv ../*.deb built-packages/amd64/ubuntu_bionic/
    5554  artifacts:
    5655    paths:
     
    6059    - tags
    6160
    62 build-ubuntu-xenial:
     61build-amd64-ubuntu-cosmic:
    6362  stage: build
    64   image: ubuntu:xenial
     63  image: ubuntu:cosmic
    6564  script:
    6665    - ./gitlab-build.sh
    67     - mkdir -p built-packages/ubuntu_xenial/
    68     - mv ../*.deb built-packages/ubuntu_xenial/
     66    - mkdir -p built-packages/amd64/ubuntu_cosmic/
     67    - mv ../*.deb built-packages/amd64/ubuntu_cosmic/
    6968  artifacts:
    7069    paths:
    7170      - built-packages/*
    7271    expire_in: 1 day
    73   only:
    74     - tags
    75 
    76 build-ubuntu-artful:
    77   stage: build
    78   image: ubuntu:artful
    79   script:
    80     - ./gitlab-build.sh
    81     - mkdir -p built-packages/ubuntu_artful/
    82     - mv ../*.deb built-packages/ubuntu_artful/
    83   artifacts:
    84     paths:
    85       - built-packages/*
    86     expire_in: 1 day
    87   only:
    88     - tags
    89 
    90 build-ubuntu-bionic:
    91   stage: build
    92   image: ubuntu:bionic
    93   script:
    94     - ./gitlab-build.sh
    95     - mkdir -p built-packages/ubuntu_bionic/
    96     - mv ../*.deb built-packages/ubuntu_bionic/
    97   artifacts:
    98     paths:
    99       - built-packages/*
    100     expire_in: 1 day
    101   only:
    102     - tags
    103 
    104 deploy-packages:
    105   stage: deploy
    106   image: ubuntu:bionic
    107   script:
    108     - ls built-packages/
    109   artifacts:
    110     paths:
    111       - built-packages/*
    112     expire_in: 1 month
    11372  only:
    11473    - tags
     
    12180  only:
    12281    - tags
    123 
  • bintray-upload.sh

    r7e25135 r41f03b7  
    33set -x -e -o pipefail
    44
    5 VERSION=${CI_COMMIT_REF_NAME}
    6 PKGVERSION=1
    7 ARCH=amd64
     5apt-get update && apt-get install -y curl
    86
    9 APIKEY=${BINTRAY_API_KEY}
    10 
    11 apt-get update
    12 apt-get install -y curl
    13 
    14 UBUNTU_DISTS=("xenial" "artful" "bionic")
    15 DEBIAN_DISTS=("stretch" "jessie" "sid" "buster")
    16 PACKAGE_LIST=("libtrace4" "libtrace4-dev" "libtrace4-tools" "libpacketdump4" "libpacketdump4-dev")
    17 
    18 for i in "${UBUNTU_DISTS[@]}"
    19 do
    20         for comp in "${PACKAGE_LIST[@]}"; do
    21                 echo ubuntu_$i/${comp}
    22 
    23                 if [ ! -f built-packages/ubuntu_$i/${comp}_${VERSION}-${PKGVERSION}_${ARCH}.deb ]; then
    24                         continue
    25                 fi
    26 
    27                 curl -T built-packages/ubuntu_$i/${comp}_${VERSION}-${PKGVERSION}_${ARCH}.deb -usalcock:$APIKEY "https://api.bintray.com/content/wand/debian/$comp/$VERSION/pool/$i/main/lib${comp:3:1}/${comp}_${VERSION}-${PKGVERSION}_${ARCH}.deb;deb_distribution=$i;deb_component=main;deb_architecture=$ARCH"
    28         done
     7for path in `find built-packages/amd64/ -maxdepth 1 -type d`; do
     8    IFS=_ read linux_dist linux_version <<< $(basename "${path}")
     9    for deb in `find "${path}" -maxdepth 1 -type f`; do
     10        pkg_filename=$(basename "${deb}")
     11        IFS=_ read pkg_name pkg_version pkg_arch <<< $(basename -s ".deb" "${pkg_filename}")
     12        curl -T "${deb}" -u${BINTRAY_USERNAME}:${BINTRAY_API_KEY} \
     13            "https://api.bintray.com/content/wand/libtrace/${pkg_name}/${pkg_version}/pool/${linux_version}/main/${pkg_filename};deb_distribution=${linux_version};deb_component=main;deb_architecture=${pkg_arch}"
     14    done
    2915done
    30 
    31 for i in "${DEBIAN_DISTS[@]}"
    32 do
    33         for comp in "${PACKAGE_LIST[@]}"; do
    34                 echo debian_$i/${comp}
    35                 if [ ! -f built-packages/debian_$i/${comp}_${VERSION}-${PKGVERSION}_${ARCH}.deb ]; then
    36                         continue
    37                 fi
    38 
    39                 curl -T built-packages/debian_$i/${comp}_${VERSION}-${PKGVERSION}_${ARCH}.deb -usalcock:$APIKEY "https://api.bintray.com/content/wand/debian/$comp/$VERSION/pool/$i/main/lib${comp:3:1}/${comp}_${VERSION}-${PKGVERSION}_${ARCH}.deb;deb_distribution=$i;deb_component=main;deb_architecture=$ARCH"
    40         done
    41 done
  • gitlab-build.sh

    rdd48bb5 r41f03b7  
    1111    apt-utils ssl-cert ca-certificates gnupg lsb-release debhelper git
    1212
    13 echo "deb https://packages.wand.net.nz $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/wand.list
    14 curl https://packages.wand.net.nz/keyring.gpg -o /etc/apt/trusted.gpg.d/wand.gpg
     13echo "deb https://dl.bintray.com/wand/general $(lsb_release -sc) main" | \
     14    tee -a /etc/apt/sources.list.d/wand.list
     15curl "https://bintray.com/user/downloadSubjectPublicKey?username=wand" \
     16    -o /etc/apt/trusted.gpg.d/wand.gpg
    1517
    1618apt-get update
Note: See TracChangeset for help on using the changeset viewer.