diff --git a/.drone.yml b/.drone.yml index 7e9e0fc..5d740df 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,6 +10,7 @@ steps: - name: push-built-init-image image: plugins/docker settings: + dockerfile: Dockerfile-initImage registry: gitea.scubbo.org repo: gitea.scubbo.org/scubbo/drone-build-status-monitor-init username: scubbo @@ -18,7 +19,6 @@ steps: - name: push-built-main-image image: plugins/docker settings: - dockerfile: Dockerfile-initImage registry: gitea.scubbo.org repo: gitea.scubbo.org/scubbo/drone-build-status-monitor-main username: scubbo diff --git a/Dockerfile-initImage b/Dockerfile-initImage index 49f7391..b190f77 100644 --- a/Dockerfile-initImage +++ b/Dockerfile-initImage @@ -3,7 +3,8 @@ FROM alpine RUN apk update RUN apk upgrade RUN apk add curl -RUN curl -L https://github.com/harness/drone-cli/releases/latest/download/drone_linux_amd64.tar.gz | tar zx +#RUN apk add bash # Necessary in order to run drone +RUN curl -L https://github.com/harness/drone-cli/releases/latest/download/drone_linux_arm64.tar.gz | tar zx RUN install -t /usr/local/bin drone WORKDIR /app diff --git a/demo/main-script.sh b/demo/main-script.sh old mode 100644 new mode 100755 diff --git a/src/init/init.sh b/src/init/init.sh index da9d018..8d51a99 100644 --- a/src/init/init.sh +++ b/src/init/init.sh @@ -1,8 +1,7 @@ #!/bin/sh metrics_user_exists() { - [ $(drone -s "$DRONE_DOMAIN" -t "$PRIMARY_DRONE_USER_TOKEN" user ls 2>/dev/null | \ - grep -c '^build-metrics$') -ne 0 ] + [ $(drone -s "$DRONE_DOMAIN" -t "$PRIMARY_DRONE_USER_TOKEN" user ls 2>/dev/null | grep -c '^build-metrics$') -ne 0 ] # `return` on its own will return the return code of the previous statement. # Bash is a very sensible and normal programming language return @@ -16,7 +15,7 @@ else # but if you wanted to get really finicky with permissions you could create different # metrics users with different permissions. drone -s "$DRONE_DOMAIN" -t "$PRIMARY_DRONE_USER_TOKEN" \ - user add --machine --admin --token "$METRICS_DRONE_USER_TOKEN" build-metrics 2>/dev/null + user add --machine --admin --token "$METRICS_DRONE_USER_TOKEN" build-metrics # Double-check! if ! metrics_user_exists; then echo "Tried creating the user, but it still doesn't exist - something's gone wrong"