Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deploy in travis ci #11

Merged
merged 1 commit into from
Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 3 additions & 26 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
# 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}