Skip to content

Commit

Permalink
fix deploy in travis ci
Browse files Browse the repository at this point in the history
  • Loading branch information
moshe010 committed Mar 15, 2020
1 parent 0b63937 commit e981661
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 27 deletions.
31 changes: 4 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
language: go

dist: bionic

services:
- docker

go:
- "1.13"

env:
global:
- PATH=$GOROOT/bin:$GOPATH/bin:$PATH
- IMAGE_NAME=mellanox/rdma-cni
- IMAGE_NAME=mellanox/rdma-cni

before_script:
- go get -u github.com/mattn/goveralls
Expand All @@ -29,29 +22,13 @@ deploy:
# Push image to Dockerhub on merge to master
- provider: script
skip_cleanup: true
script: >
bash -cx '
docker tag $(IMAGE_NAME) $(IMAGE_NAME)-$(TRAVIS_CPU_ARCH):latest;
docker push $(IMAGE_NAME)-$(TRAVIS_CPU_ARCH):latest;
export DOCKER_CLI_EXPERIMENTAL="enabled";
docker manifest create $(IMAGE_NAME):latest $(IMAGE_NAME)-$(TRAVIS_CPU_ARCH):latest;
docker manifest annotate $(IMAGE_NAME):latest $(IMAGE_NAME)-$(TRAVIS_CPU_ARCH):latest --arch $(TRAVIS_CPU_ARCH);
docker manifest push $(IMAGE_NAME):latest
echo Done'
script: bash scripts/deploy.sh $IMAGE_NAME latest $TRAVIS_CPU_ARCH
on:
branch: master
branch: master
# Push image to Dockerhub on tag
- provider: script
skip_cleanup: true
script: >
bash -cx '
docker tag $(IMAGE_NAME) $(IMAGE_NAME)-$(TRAVIS_CPU_ARCH):$(TRAVIS_TAG);
docker push $(IMAGE_NAME)-$(TRAVIS_CPU_ARCH):$(TRAVIS_TAG);
export DOCKER_CLI_EXPERIMENTAL="enabled";
docker manifest create $(IMAGE_NAME):$(TRAVIS_TAG) $(IMAGE_NAME)-$(TRAVIS_CPU_ARCH):$(TRAVIS_TAG);
docker manifest annotate $(IMAGE_NAME):$(TRAVIS_TAG) $(IMAGE_NAME)-$(TRAVIS_CPU_ARCH):$(TRAVIS_TAG) --arch $(TRAVIS_CPU_ARCH);
docker manifest push $(IMAGE_NAME):$(TRAVIS_TAG)
echo Done'
script: bash scripts/deploy.sh $IMAGE_NAME $TRAVIS_TAG $TRAVIS_CPU_ARCH
on:
tags: true
all_branches: true
Expand Down
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 e981661

Please sign in to comment.