Skip to content

Commit 703962f

Browse files
committed
Fixed push to docker from travis-ci
1 parent 4f86b3a commit 703962f

File tree

6 files changed

+142
-26
lines changed

6 files changed

+142
-26
lines changed

.travis.yml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,12 @@ os:
44
services:
55
- docker
66
language: go
7-
env:
8-
global:
9-
- PLUGIN_NAME_ROOTFS=docker-volume-linode:rootfs-${TRAVIS_BUILD_NUMBER}
10-
- PLUGIN_NAME=docker-volume-linode:${TRAVIS_BRANCH}.${TRAVIS_BUILD_NUMBER}
11-
before_install:
12-
- go get -u github.com/golang/dep/cmd/dep
13-
script:
14-
- dep ensure
15-
- docker build --no-cache -q -t ${PLUGIN_NAME_ROOTFS} .
16-
- mkdir -p ./plugin/rootfs
17-
- docker create --name tmp ${PLUGIN_NAME_ROOTFS}
18-
- docker export tmp | tar -x -C ./plugin/rootfs
19-
- cp config.json ./plugin/
20-
- docker rm -vf tmp
21-
- docker plugin rm -f ${PLUGIN_NAME} || true
22-
- docker plugin create ${PLUGIN_NAME} ./plugin
23-
deploy:
24-
provider: script
25-
script: bash docker_push
26-
on:
27-
tags: true
7+
8+
jobs:
9+
include:
10+
- stage: build
11+
script: ./scripts/build.sh
12+
- stage: test
13+
script: ./scripts/test.sh
14+
- stage: deploy
15+
script: ./scripts/deploy.sh

Gopkg.lock

Lines changed: 38 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/build.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
scriptDir=`dirname $(readlink -f $0)`
6+
source $scriptDir/common.sh
7+
8+
##############################
9+
echo "go get -u github.com/golang/dep/cmd/dep"
10+
go get -u github.com/golang/dep/cmd/dep
11+
##############################
12+
echo "dep ensure"
13+
dep ensure
14+
##############################
15+
echo "docker build --no-cache -q -t ${PLUGIN_NAME_ROOTFS} ."
16+
docker build --no-cache -q -t ${PLUGIN_NAME_ROOTFS} .
17+
##############################
18+
echo "mkdir -p ./plugin/rootfs"
19+
mkdir -p ./plugin/rootfs
20+
##############################
21+
echo "docker create --name tmp ${PLUGIN_NAME_ROOTFS}"
22+
docker create --name tmp ${PLUGIN_NAME_ROOTFS}
23+
##############################
24+
echo "docker export tmp | tar -x -C ./plugin/rootfs"
25+
docker export tmp | tar -x -C ./plugin/rootfs
26+
##############################
27+
echo "cp config.json ./plugin/"
28+
cp config.json ./plugin/
29+
##############################
30+
echo "docker rm -vf tmp"
31+
docker rm -vf tmp
32+
##############################
33+
echo "docker plugin rm -f ${PLUGIN_NAME} || true"
34+
docker plugin rm -f ${PLUGIN_NAME} || true
35+
##############################
36+
echo "docker plugin create ${PLUGIN_NAME} ./plugin"
37+
docker plugin create ${PLUGIN_NAME} ./plugin
38+
##############################

scripts/common.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
##############################
4+
export PLUGIN_NAME_ROOTFS=docker-volume-linode:rootfs-${TRAVIS_BUILD_NUMBER}
5+
export PLUGIN_NAME=libgolang/docker-volume-linode:${TRAVIS_BRANCH}.${TRAVIS_BUILD_NUMBER}
6+
export PLUGIN_NAME_TAR=docker-volume-linode_${TRAVIS_BRANCH}.${TRAVIS_BUILD_NUMBER}.tar
7+
##############################
8+

scripts/deploy.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
##############################
6+
scriptDir=`dirname $(readlink -f $0)`
7+
source $scriptDir/common.sh
8+
9+
##############################
10+
echo "go get -u github.com/golang/dep/cmd/dep"
11+
go get -u github.com/golang/dep/cmd/dep
12+
##############################
13+
echo "dep ensure"
14+
dep ensure
15+
##############################
16+
echo "docker build --no-cache -q -t ${PLUGIN_NAME_ROOTFS} ."
17+
docker build --no-cache -q -t ${PLUGIN_NAME_ROOTFS} .
18+
##############################
19+
echo "mkdir -p ./plugin/rootfs"
20+
mkdir -p ./plugin/rootfs
21+
##############################
22+
echo "docker create --name tmp ${PLUGIN_NAME_ROOTFS}"
23+
docker create --name tmp ${PLUGIN_NAME_ROOTFS}
24+
##############################
25+
echo "docker export tmp | tar -x -C ./plugin/rootfs"
26+
docker export tmp | tar -x -C ./plugin/rootfs
27+
##############################
28+
echo "cp config.json ./plugin/"
29+
cp config.json ./plugin/
30+
##############################
31+
echo "docker rm -vf tmp"
32+
docker rm -vf tmp
33+
##############################
34+
echo "docker plugin rm -f ${PLUGIN_NAME} || true"
35+
docker plugin rm -f ${PLUGIN_NAME} || true
36+
##############################
37+
echo "docker plugin create ${PLUGIN_NAME} ./plugin"
38+
docker plugin create ${PLUGIN_NAME} ./plugin
39+
##############################
40+
41+
42+
##############################
43+
echo "docker login -u libgolang --password-stdin"
44+
echo "$DOCKER_PASSWORD" | docker login -u libgolang --password-stdin
45+
echo "docker plugin push ${PLUGIN_NAME}"
46+
docker plugin push ${PLUGIN_NAME}
47+

scripts/test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+

0 commit comments

Comments
 (0)