Skip to content

Commit

Permalink
Merge pull request #24 from Mmduh-483/deploy-tag
Browse files Browse the repository at this point in the history
Deploy image on adding tag
  • Loading branch information
moshe010 authored Apr 9, 2020
2 parents 1bacf54 + 63f696d commit da58da7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ language: go
go:
- 1.13.x

env:
- IMAGE_NAME=mellanox/ib-sriov-cni

before_script:
- go get github.com/mattn/goveralls

Expand All @@ -20,9 +23,14 @@ deploy:
# Push image to Dockerhub on merge to master
- provider: script
skip_cleanup: true
script: >
bash -c '
docker push $IMAGE_NAME;
echo done'
script: bash scripts/deploy.sh $IMAGE_NAME latest $TRAVIS_CPU_ARCH
on:
branch: master
# Push image to Dockerhub on tag
- provider: script
skip_cleanup: true
script: bash scripts/deploy.sh $IMAGE_NAME $TRAVIS_TAG $TRAVIS_CPU_ARCH
on:
tags: true
all_branches: true
condition: "$TRAVIS_TAG =~ ^v[0-9].*$"
10 changes: 10 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
IMAGE_NAME=$1
VERSION=$2
CPU_ARCH=$3
export DOCKER_CLI_EXPERIMENTAL="enabled";
docker tag $IMAGE_NAME ${IMAGE_NAME}-${CPU_ARCH}:${VERSION}
docker push ${IMAGE_NAME}-${CPU_ARCH}:${VERSION}
docker manifest create ${IMAGE_NAME}:${VERSION} ${IMAGE_NAME}-${CPU_ARCH}:${VERSION}
docker manifest annotate ${IMAGE_NAME}:${VERSION} ${IMAGE_NAME}-${CPU_ARCH}:${VERSION} --arch ${CPU_ARCH}
docker manifest push ${IMAGE_NAME}:${VERSION}

0 comments on commit da58da7

Please sign in to comment.