From 63d8305bb71d18c41fd1b3361990aa02688cdae5 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Wed, 4 May 2016 12:51:06 -0700 Subject: [PATCH] fixed issue with incorrect push command --- .drone.sec | 1 - .drone.yml | 20 ++++++++------------ .drone.yml.sig | 1 + README.md | 4 +++- plugin.go | 7 ++++--- 5 files changed, 16 insertions(+), 17 deletions(-) delete mode 100644 .drone.sec create mode 100644 .drone.yml.sig diff --git a/.drone.sec b/.drone.sec deleted file mode 100644 index db6ecc0..0000000 --- a/.drone.sec +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkExMjhHQ00ifQ.JlxE-t1MnDlzY5ysWCSDXIjcwUHofIan5P9cfBYGZ6NchhQWXyDlC3daezqCfGqA4aOQk0Ig4Z1Vz1fI3RX_BPE9vRGmZMOLWMpc-BBgBtXke_prDPRmDKZkqFTKC2Ys7raCWgbj3Q8r_AKaJNdWxWNELAENOocsZNF2QZv-LdHb6KAGubeKXYoU2tKfcqrIiR9ChUiaW3ZuS_4rYl7xJsFhn5_hh964qCOVfOyO49kLd7kFhAE72OKIH_Oz_Xs0NYNI3O-5L1rhvVgdaI_70ZejzeNer_e85dt1B1HW63inx3hnFkab0WdASypxGNjOlZuvnu2VmlJi-lRG37cEWA.HgW6X32JWV04WHcP.DASErZ7lvDzxWz9jFUJ3lJpRNbdEU5tRMBTe01GEdP9wveHVlZTS_cruE-1i-Nbro7v8vYxuP7Hdruk36cnCMAcaSc4Z_PqkPsR3PyLMd_VV0A1zlabo706huy0wliMnr0F8G17x043J2yyYMPgiVjbImYD4xC2OL7SbQH0zkIuctGuzQ6K2Xwpc89n2-zPP6fddX4D1Wpwi7CP_f-Cr5lP0jevZW8vv__H0tRqxSRaw57aPh4viLQVgMqWxXMA.WypEt7MPRG9ujeCLP5800w \ No newline at end of file diff --git a/.drone.yml b/.drone.yml index 0d57238..4c1e2a9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,25 +1,21 @@ -build: +workspace: + base: /go + +script: test: - image: golang:1.5 + image: golang:1.6 environment: - CGO_ENABLED=0 - - GO15VENDOREXPERIMENT=1 commands: - go test -cover -coverprofile=coverage.out - go build -ldflags "-s -w -X main.build=$DRONE_BUILD_NUMBER" - -publish: - coverage: - when: - branch: master docker: - username: $$DOCKER_USER - password: $$DOCKER_PASS - email: $$DOCKER_EMAIL + storage_driver: overlay repo: plugins/docker tag: latest when: - branch: release/0.5 + branch: master + event: push plugin: name: Docker diff --git a/.drone.yml.sig b/.drone.yml.sig new file mode 100644 index 0000000..6d1dc44 --- /dev/null +++ b/.drone.yml.sig @@ -0,0 +1 @@ +eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIGJhc2U6IC9nbwoKc2NyaXB0OgogIHRlc3Q6CiAgICBpbWFnZTogZ29sYW5nOjEuNgogICAgZW52aXJvbm1lbnQ6CiAgICAgIC0gQ0dPX0VOQUJMRUQ9MAogICAgY29tbWFuZHM6CiAgICAgIC0gZ28gdGVzdCAtY292ZXIgLWNvdmVycHJvZmlsZT1jb3ZlcmFnZS5vdXQKICAgICAgLSBnbyBidWlsZCAtbGRmbGFncyAiLXMgLXcgLVggbWFpbi5idWlsZD0kRFJPTkVfQlVJTERfTlVNQkVSIgogIGRvY2tlcjoKICAgIHN0b3JhZ2VfZHJpdmVyOiBvdmVybGF5CiAgICByZXBvOiBwbHVnaW5zL2RvY2tlcgogICAgdGFnOiBsYXRlc3QKICAgIHdoZW46CiAgICAgIGJyYW5jaDogbWFzdGVyCiAgICAgIGV2ZW50OiBwdXNoCgpwbHVnaW46CiAgbmFtZTogRG9ja2VyCiAgZGVzYzogQnVpbGQgYW5kIHB1Ymxpc2ggaW1hZ2VzIHRvIGEgRG9ja2VyIHJlZ2lzdHJ5CiAgdHlwZTogcHVibGlzaAogIGltYWdlOiBwbHVnaW5zL2RvY2tlcgogIGxhYmVsczoKICAgIC0gZG9ja2VyCiAgICAtIGltYWdlCiAgICAtIGNvbnRhaW5lcgo.Dq7c7ARGLJBH7O4swFpXpulXAjuyHMfiJzRq6Xpc5RM \ No newline at end of file diff --git a/README.md b/README.md index 1564e78..5370367 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ Build the docker image with the following commands: ``` export GO15VENDOREXPERIMENT=1 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo + +docker build --rm=true -t plugins/docker . ``` Please note incorrectly building the image for the correct x64 linux and with GCO disabled will result in an error when running the Docker image: @@ -37,7 +39,7 @@ docker run --rm \ -e PLUGIN_TAG=latest \ -e PLUGIN_REPO=octocat/hello-world \ -e DRONE_COMMIT_SHA=d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab \ - -v $(pwd)/$(pwd) \ + -v $(pwd):$(pwd) \ -w $(pwd) \ --privileged \ plugins/docker --dry-run diff --git a/plugin.go b/plugin.go index 52bda2a..1a9dd45 100644 --- a/plugin.go +++ b/plugin.go @@ -100,7 +100,7 @@ func (p Plugin) Exec() error { cmds = append(cmds, commandTag(p.Build, tag)) // docker tag if p.Dryrun == false { - cmds = append(cmds, commandPush(tag)) // docker push + cmds = append(cmds, commandPush(p.Build, tag)) // docker push } } @@ -168,8 +168,9 @@ func commandTag(build Build, tag string) *exec.Cmd { } // helper function to create the docker push command. -func commandPush(tag string) *exec.Cmd { - return exec.Command("/usr/bin/docker", "push", tag) +func commandPush(build Build, tag string) *exec.Cmd { + target := fmt.Sprintf("%s:%s", build.Repo, tag) + return exec.Command("/usr/bin/docker", "push", target) } // helper function to create the docker daemon command.