From 441293c20ae02d8cdc8c9c3b924f4318374678a3 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Wed, 11 Sep 2019 13:49:39 +0200 Subject: [PATCH 1/2] Upgrade to python3 --- docker/Dockerfile.linux.amd64 | 8 ++++---- docker/Dockerfile.linux.arm | 8 ++++---- docker/Dockerfile.linux.arm64 | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docker/Dockerfile.linux.amd64 b/docker/Dockerfile.linux.amd64 index 714ecdd..f4eed18 100644 --- a/docker/Dockerfile.linux.amd64 +++ b/docker/Dockerfile.linux.amd64 @@ -5,10 +5,10 @@ LABEL maintainer="Drone.IO Community " \ org.label-schema.vendor="Drone.IO Community" \ org.label-schema.schema-version="1.0" -RUN apk add --no-cache bash git curl rsync openssh-client py-pip py-requests python2-dev libffi-dev libressl-dev libressl build-base && \ - pip install -U pip && \ - pip install ansible==2.8.2 && \ - apk del python2-dev libffi-dev libressl-dev build-base +RUN apk add --no-cache bash git curl rsync openssh-client py3-pip py3-requests python3-dev libffi-dev libressl-dev libressl build-base && \ + pip3 install -U pip && \ + pip3 install ansible==2.8.4 && \ + apk del python3-dev libffi-dev libressl-dev build-base ADD release/linux/amd64/drone-ansible /bin/ ENTRYPOINT ["/bin/drone-ansible"] diff --git a/docker/Dockerfile.linux.arm b/docker/Dockerfile.linux.arm index c96033a..114201a 100644 --- a/docker/Dockerfile.linux.arm +++ b/docker/Dockerfile.linux.arm @@ -5,10 +5,10 @@ LABEL maintainer="Drone.IO Community " \ org.label-schema.vendor="Drone.IO Community" \ org.label-schema.schema-version="1.0" -RUN apk add --no-cache bash git curl rsync openssh-client py-pip py-requests python2-dev libffi-dev libressl-dev libressl build-base && \ - pip install -U pip && \ - pip install ansible==2.8.2 && \ - apk del python2-dev libffi-dev libressl-dev build-base +RUN apk add --no-cache bash git curl rsync openssh-client py3-pip py3-requests python3-dev libffi-dev libressl-dev libressl build-base && \ + pip3 install -U pip && \ + pip3 install ansible==2.8.4 && \ + apk del python3-dev libffi-dev libressl-dev build-base ADD release/linux/arm/drone-ansible /bin/ ENTRYPOINT ["/bin/drone-ansible"] diff --git a/docker/Dockerfile.linux.arm64 b/docker/Dockerfile.linux.arm64 index 17e9445..45115e0 100644 --- a/docker/Dockerfile.linux.arm64 +++ b/docker/Dockerfile.linux.arm64 @@ -5,10 +5,10 @@ LABEL maintainer="Drone.IO Community " \ org.label-schema.vendor="Drone.IO Community" \ org.label-schema.schema-version="1.0" -RUN apk add --no-cache bash git curl rsync openssh-client py-pip py-requests python2-dev libffi-dev libressl-dev libressl build-base && \ - pip install -U pip && \ - pip install ansible==2.8.2 && \ - apk del python2-dev libffi-dev libressl-dev build-base +RUN apk add --no-cache bash git curl rsync openssh-client py3-pip py3-requests python3-dev libffi-dev libressl-dev libressl build-base && \ + pip3 install -U pip && \ + pip3 install ansible==2.8.4 && \ + apk del python3-dev libffi-dev libressl-dev build-base ADD release/linux/arm64/drone-ansible /bin/ ENTRYPOINT ["/bin/drone-ansible"] From 851ebcad3da0d350c5b2252229ea4f91217a93f3 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Wed, 11 Sep 2019 13:51:06 +0200 Subject: [PATCH 2/2] Format go code like the other plugins --- plugin.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugin.go b/plugin.go index 5cd6575..a0630ed 100644 --- a/plugin.go +++ b/plugin.go @@ -173,20 +173,25 @@ func (p *Plugin) vaultPass() error { } func (p *Plugin) playbooks() error { - var playbooks []string + var ( + playbooks []string + ) + for _, p := range p.Config.Playbooks { files, err := filepath.Glob(p) - // can there be a invalid glob pattern that still is a valid file name? - // just add it back to the list and let ansible return error out instead. + if err != nil { playbooks = append(playbooks, p) continue } + playbooks = append(playbooks, files...) } + if len(playbooks) == 0 { return errors.New("failed to find playbook files") } + p.Config.Playbooks = playbooks return nil }