Correct Dockerfiles for .drone.yml

This commit is contained in:
Jack Jackson 2022-12-08 20:05:08 -08:00
parent 8e5fdff0cd
commit f17e72f491
4 changed files with 5 additions and 5 deletions

View File

@ -10,6 +10,7 @@ steps:
- name: push-built-init-image - name: push-built-init-image
image: plugins/docker image: plugins/docker
settings: settings:
dockerfile: Dockerfile-initImage
registry: gitea.scubbo.org registry: gitea.scubbo.org
repo: gitea.scubbo.org/scubbo/drone-build-status-monitor-init repo: gitea.scubbo.org/scubbo/drone-build-status-monitor-init
username: scubbo username: scubbo
@ -18,7 +19,6 @@ steps:
- name: push-built-main-image - name: push-built-main-image
image: plugins/docker image: plugins/docker
settings: settings:
dockerfile: Dockerfile-initImage
registry: gitea.scubbo.org registry: gitea.scubbo.org
repo: gitea.scubbo.org/scubbo/drone-build-status-monitor-main repo: gitea.scubbo.org/scubbo/drone-build-status-monitor-main
username: scubbo username: scubbo

View File

@ -3,7 +3,8 @@ FROM alpine
RUN apk update RUN apk update
RUN apk upgrade RUN apk upgrade
RUN apk add curl 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 RUN install -t /usr/local/bin drone
WORKDIR /app WORKDIR /app

0
demo/main-script.sh Normal file → Executable file
View File

View File

@ -1,8 +1,7 @@
#!/bin/sh #!/bin/sh
metrics_user_exists() { metrics_user_exists() {
[ $(drone -s "$DRONE_DOMAIN" -t "$PRIMARY_DRONE_USER_TOKEN" user ls 2>/dev/null | \ [ $(drone -s "$DRONE_DOMAIN" -t "$PRIMARY_DRONE_USER_TOKEN" user ls 2>/dev/null | grep -c '^build-metrics$') -ne 0 ]
grep -c '^build-metrics$') -ne 0 ]
# `return` on its own will return the return code of the previous statement. # `return` on its own will return the return code of the previous statement.
# Bash is a very sensible and normal programming language # Bash is a very sensible and normal programming language
return return
@ -16,7 +15,7 @@ else
# but if you wanted to get really finicky with permissions you could create different # but if you wanted to get really finicky with permissions you could create different
# metrics users with different permissions. # metrics users with different permissions.
drone -s "$DRONE_DOMAIN" -t "$PRIMARY_DRONE_USER_TOKEN" \ 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! # Double-check!
if ! metrics_user_exists; then if ! metrics_user_exists; then
echo "Tried creating the user, but it still doesn't exist - something's gone wrong" echo "Tried creating the user, but it still doesn't exist - something's gone wrong"