Skip to content

Commit 24c400c

Browse files
authored
Merge pull request Mellanox#5 from moshe010/fix_deploy
fix deploy in travis
2 parents fa4fccd + 8daa296 commit 24c400c

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

.travis.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
language: go
22

3+
go:
4+
- "1.13"
5+
6+
env:
7+
- IMAGE_NAME=mellanox/ib-kubernetes
8+
39
before_script:
410
- go get -u github.com/mattn/goveralls
511

6-
script: # to allow coverage pass, change repo name to github.com/mellanox
12+
script:
713
- make
814
- make test-coverage
915
- goveralls -coverprofile=ib-kubernetes.cover -service=travis-ci
@@ -16,9 +22,14 @@ deploy:
1622
# Push image to Dockerhub on merge to master
1723
- provider: script
1824
skip_cleanup: true
19-
script: >
20-
bash -c '
21-
docker push $IMAGE_NAME;
22-
echo done'
25+
script: bash scripts/deploy.sh $IMAGE_NAME latest $TRAVIS_CPU_ARCH
2326
on:
2427
branch: master
28+
# Push image to Dockerhub on tag
29+
- provider: script
30+
skip_cleanup: true
31+
script: bash scripts/deploy.sh $IMAGE_NAME $TRAVIS_TAG $TRAVIS_CPU_ARCH
32+
on:
33+
tags: true
34+
all_branches: true
35+
condition: "$TRAVIS_TAG =~ ^v[0-9].*$"

scripts/deploy.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
IMAGE_NAME=$1
3+
VERSION=$2
4+
CPU_ARCH=$3
5+
export DOCKER_CLI_EXPERIMENTAL="enabled";
6+
docker tag $IMAGE_NAME ${IMAGE_NAME}-${CPU_ARCH}:${VERSION}
7+
docker push ${IMAGE_NAME}-${CPU_ARCH}:${VERSION}
8+
docker manifest create ${IMAGE_NAME}:${VERSION} ${IMAGE_NAME}-${CPU_ARCH}:${VERSION}
9+
docker manifest annotate ${IMAGE_NAME}:${VERSION} ${IMAGE_NAME}-${CPU_ARCH}:${VERSION} --arch ${CPU_ARCH}
10+
docker manifest push ${IMAGE_NAME}:${VERSION}

0 commit comments

Comments
 (0)