@@ -17,8 +17,8 @@ addons:
1717 # The docker manifest command was added in docker-ee version 18.x
1818 # So update our current installation and we also have to enable the experimental features.
1919 sources :
20- - sourceline : ' deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable'
21- key_url : ' https://download.docker.com/linux/ubuntu/gpg'
20+ - sourceline : " deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
21+ key_url : " https://download.docker.com/linux/ubuntu/gpg"
2222 packages :
2323 - docker-ce
2424
@@ -31,10 +31,10 @@ before_install:
3131 - sudo service docker restart
3232
3333install :
34- # For cross buidling our images
35- # This is necessary because travis-ci.org has only x86_64 machines.
36- # If travis-ci.org gets native arm builds, probably this step is not
37- # necessary any more.
34+ # For cross buidling our images
35+ # This is necessary because travis-ci.org has only x86_64 machines.
36+ # If travis-ci.org gets native arm builds, probably this step is not
37+ # necessary any more.
3838 - docker run --rm --privileged multiarch/qemu-user-static:register --reset
3939 # Bats is necessary for the UT
4040 - curl -o bats.tar.gz -SL https://github.com/bats-core/bats-core/archive/v1.1.0.tar.gz
@@ -46,38 +46,44 @@ install:
4646before_script :
4747 # Set baseimage.
4848 # remove pqchecker if arch is not amd64
49- # we are injecting them in the build scripts and we do not include them in the Dockerfiles
5049 - sed -i -e "s/FROM \(.*\)/FROM \1-${TARGET_ARCH}/g" image/Dockerfile;
5150 - if [[ "${TARGET_ARCH}" != 'amd64' ]]; then
52- sed -i -e "/PQCHECKER/Id" image/Dockerfile;
51+ sed -i -e "/PQCHECKER/Id" image/Dockerfile;
5352 fi
5453 - cat image/Dockerfile;
5554 # If this is a tag then change the VERSION variable to only have the
5655 # tag name and not also the commit hash.
5756 - if [ -n "$TRAVIS_TAG" ]; then
58- VERSION=$(echo "${TRAVIS_TAG}" | sed -e 's/\(.*\)[-v]\(.*\)/\1\2/g');
57+ VERSION=$(echo "${TRAVIS_TAG}" | sed -e 's/\(.*\)[-v]\(.*\)/\1\2/g');
5958 fi
6059
6160script :
6261 - make build-nocache NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}
63-
64- after_success :
62+ # Run the test and if the test fails mark the build as failed.
6563 - make test NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}
64+
65+ before_deploy :
6666 - docker run -d --name test_image ${NAME}:${VERSION}-${TARGET_ARCH} sleep 10
6767 - sleep 5
6868 - sudo docker ps | grep -q test_image
6969 # To have `DOCKER_USER` and `DOCKER_PASS`
7070 # use `travis env set`.
7171 - docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
7272 - make tag NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}
73- - make push NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}
73+
74+ deploy :
75+ provider : script
76+ on :
77+ repo : osixia/openldap
78+ all_branches : true
79+ script : make push NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}
7480
7581jobs :
7682 include :
77- - stage : deploy
83+ - stage : Manifest creation
7884 install : skip
7985 script : skip
80- after_success :
86+ after_deploy :
8187 - docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
8288 - docker manifest create ${NAME}:${VERSION} ${NAME}:${VERSION}-amd64 ${NAME}:${VERSION}-i386 ${NAME}:${VERSION}-arm32v7 ${NAME}:${VERSION}-arm64v8;
8389 docker manifest annotate ${NAME}:${VERSION} ${NAME}:${VERSION}-amd64 --os linux --arch amd64;
@@ -87,14 +93,14 @@ jobs:
8793
8894 # The latest tag is coming from the stable branch of the repo
8995 - if [ "${TRAVIS_BRANCH}" == 'stable' ]; then
90- docker manifest create ${NAME}:latest ${NAME}:${VERSION}-amd64 ${NAME}:${VERSION}-i386 ${NAME}:${VERSION}-arm32v7 ${NAME}:${VERSION}-arm64v8;
91- docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-amd64 --os linux --arch amd64;
92- docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-i386 --os linux --arch 386;
93- docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-arm32v7 --os linux --arch arm --variant v7;
94- docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-arm64v8 --os linux --arch arm64 --variant v8;
96+ docker manifest create ${NAME}:latest ${NAME}:${VERSION}-amd64 ${NAME}:${VERSION}-i386 ${NAME}:${VERSION}-arm32v7 ${NAME}:${VERSION}-arm64v8;
97+ docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-amd64 --os linux --arch amd64;
98+ docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-i386 --os linux --arch 386;
99+ docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-arm32v7 --os linux --arch arm --variant v7;
100+ docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-arm64v8 --os linux --arch arm64 --variant v8;
95101 fi
96102
97103 - docker manifest push ${NAME}:${VERSION};
98104 if [ "${TRAVIS_BRANCH}" == 'stable' ]; then
99- docker manifest push ${NAME}:latest;
100- fi
105+ docker manifest push ${NAME}:latest;
106+ fi
0 commit comments