From 7c8e463929935504879318ddf08bb6c145a23cf2 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Fri, 26 Jul 2024 12:45:57 +0100 Subject: [PATCH] ci: migrate to woodpecker on arm64 as part of migrating most of my services to a new server, I've switched CI to woodpecker, a fork of drone. CI configs are now in .woodpecker/, and are neater. The server runs on arm64, so the configs and prerequisite jfa-go-build-docker are built to run there primarily. They should work on other platforms still. New CI is at ci.hrfee.dev. --- .drone.yml => .drone.yml.old | 0 .woodpecker/git-binary.yaml | 48 ++++++++++++++++++++++++++++++++++ .woodpecker/git-docker.yaml | 26 ++++++++++++++++++ .woodpecker/stable-binary.yaml | 32 +++++++++++++++++++++++ .woodpecker/stable-docker.yaml | 26 ++++++++++++++++++ 5 files changed, 132 insertions(+) rename .drone.yml => .drone.yml.old (100%) create mode 100644 .woodpecker/git-binary.yaml create mode 100644 .woodpecker/git-docker.yaml create mode 100644 .woodpecker/stable-binary.yaml create mode 100644 .woodpecker/stable-docker.yaml diff --git a/.drone.yml b/.drone.yml.old similarity index 100% rename from .drone.yml rename to .drone.yml.old diff --git a/.woodpecker/git-binary.yaml b/.woodpecker/git-binary.yaml new file mode 100644 index 0000000..df5de88 --- /dev/null +++ b/.woodpecker/git-binary.yaml @@ -0,0 +1,48 @@ +when: + - event: push + branch: main + # - evaluate: 'CI_PIPELINE_EVENT != "PULL_REQUEST" && CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH' + +clone: + git: + image: woodpeckerci/plugin-git + settings: + tags: true + +steps: + - name: redoc + image: docker.io/hrfee/jfa-go-build-docker:latest + environment: + REDOC_SSH_ID: + from_secret: REDOC_SSH_ID + commands: + - sh -c "echo \"$REDOC_SSH_ID\" > /tmp/id_redoc && chmod 600 /tmp/id_redoc" + - bash -c 'sftp -P 3625 -i /tmp/id_redoc -o StrictHostKeyChecking=no redoc@api.jfa-go.com:/home/redoc <<< $"put docs/swagger.json jfa-go.json"' + - name: build + image: docker.io/hrfee/jfa-go-build-docker:latest + environment: + JFA_GO_SNAPSHOT: y + JFA_GO_BUILT_BY: + from_secret: BUILT_BY + commands: + - curl -sfL https://goreleaser.com/static/run > goreleaser + - chmod +x goreleaser + - ./scripts/version.sh ./goreleaser --snapshot --skip=publish --clean + - name: deb-repo + image: docker.io/hrfee/jfa-go-build-docker:latest + environment: + REPO_SSH_ID: + from_secret: REPO_SSH_ID + commands: + - sh -c "echo \"$REPO_SSH_ID\" > /tmp/id_repo && chmod 600 /tmp/id_repo" + - bash -c 'sftp -P 2022 -i /tmp/id_repo -o StrictHostKeyChecking=no root@161.97.102.153:/repo/incoming <<< $"put dist/*.deb"' + - bash -c 'ssh -i /tmp/id_repo root@161.97.102.153 -p 2022 "repo-process-deb trusty"' + - bash -c 'ssh -i /tmp/id_repo root@161.97.102.153 -p 2022 "rm -f /repo/incoming/*.deb"' + - name: buildrone + image: docker.io/hrfee/jfa-go-build-docker:latest + environment: + BUILDRONE_KEY: + from_secret: BUILDRONE_KEY + commands: + - wget https://builds.hrfee.pw/upload.py + - bash -c 'python3 upload.py https://builds.hrfee.pw hrfee jfa-go --upload ./dist/*.zip ./dist/*.rpm ./dist/*.apk --tag internal-git=true' diff --git a/.woodpecker/git-docker.yaml b/.woodpecker/git-docker.yaml new file mode 100644 index 0000000..49e5d66 --- /dev/null +++ b/.woodpecker/git-docker.yaml @@ -0,0 +1,26 @@ +when: + - event: push + branch: main + +steps: + - name: build + image: docker.io/woodpeckerci/plugin-docker-buildx + settings: + username: + from_secret: DOCKER_USERNAME + password: + from_secret: DOCKER_TOKEN + repo: docker.io/hrfee/jfa-go + tags: FIXME-unstable + registry: docker.io + platforms: linux/amd64,linux/arm64,linux/arm/v7 + - name: buildrone + image: docker.io/python + environment: + BUILDRONE_KEY: + from_secret: BUILDRONE_KEY + commands: + - wget https://builds.hrfee.pw/upload.py + - pip install requests + - python upload.py https://builds.hrfee.pw hrfee jfa-go --tag docker-unstable=true + diff --git a/.woodpecker/stable-binary.yaml b/.woodpecker/stable-binary.yaml new file mode 100644 index 0000000..0ab04b1 --- /dev/null +++ b/.woodpecker/stable-binary.yaml @@ -0,0 +1,32 @@ +when: + - event: tag + branch: main + +steps: + - name: build + image: docker.io/hrfee/jfa-go-build-docker:latest + environment: + JFA_GO_BUILT_BY: + from_secret: BUILT_BY + commands: + - curl -sfL https://goreleaser.com/static/run > ../goreleaser + - chmod +x ../goreleaser + - ./scripts/version.sh ../goreleaser + - name: deb-repo + image: docker.io/hrfee/jfa-go-build-docker:latest + environment: + REPO_SSH_ID: + from_secret: REPO_SSH_ID + commands: + - sh -c "echo \"$REPO_SSH_ID\" > /tmp/id_repo && chmod 600 /tmp/id_repo" + - bash -c 'sftp -P 2022 -i /tmp/id_repo -o StrictHostKeyChecking=no root@161.97.102.153:/repo/incoming <<< $"put dist/*.deb"' + - bash -c 'ssh -i /tmp/id_repo root@161.97.102.153 -p 2022 "repo-process-deb trusty"' + - bash -c 'ssh -i /tmp/id_repo root@161.97.102.153 -p 2022 "rm -f /repo/incoming/*.deb"' + - name: buildrone + image: docker.io/hrfee/jfa-go-build-docker:latest + environment: + BUILDRONE_KEY: + from_secret: BUILDRONE_KEY + commands: + - wget https://builds.hrfee.pw/upload.py + - bash -c 'python3 upload.py https://builds.hrfee.pw hrfee jfa-go --tag internal=true' diff --git a/.woodpecker/stable-docker.yaml b/.woodpecker/stable-docker.yaml new file mode 100644 index 0000000..7f94069 --- /dev/null +++ b/.woodpecker/stable-docker.yaml @@ -0,0 +1,26 @@ +when: + - event: tag + branch: main + +steps: + - name: build + image: docker.io/woodpeckerci/plugin-docker-buildx + settings: + username: + from_secret: DOCKER_USERNAME + password: + from_secret: DOCKER_TOKEN + repo: docker.io/hrfee/jfa-go + tags: FIXME-latest + registry: docker.io + platforms: linux/amd64,linux/arm64,linux/arm/v7 + - name: buildrone + image: docker.io/python + environment: + BUILDRONE_KEY: + from_secret: BUILDRONE_KEY + commands: + - wget https://builds.hrfee.pw/upload.py + - pip install requests + - python upload.py https://builds.hrfee.pw hrfee jfa-go --tag docker-stable=true +