From aa4c9c3215bd8c26936fc6b06d76cd2928018b01 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sun, 18 Jun 2023 07:09:30 -0400 Subject: [PATCH] build nightly docker images (#25317) (#25333) Backport #25317 by @techknowlogick followup of https://github.com/go-gitea/gitea/pull/25308 this time to build & push nightly docker images Co-authored-by: techknowlogick --- .drone.yml | 304 -------------------------- .github/workflows/release-nightly.yml | 32 ++- 2 files changed, 30 insertions(+), 306 deletions(-) diff --git a/.drone.yml b/.drone.yml index d54f3c198..5d4e13038 100644 --- a/.drone.yml +++ b/.drone.yml @@ -244,133 +244,6 @@ steps: exclude: - pull_request ---- -kind: pipeline -type: docker -name: docker-linux-amd64-release - -platform: - os: linux - arch: amd64 - -trigger: - ref: - - refs/heads/main - -steps: - - name: fetch-tags - image: docker:git - pull: always - commands: - - git fetch --tags --force - - - name: publish - image: plugins/docker:latest - pull: always - settings: - auto_tag: false - tags: nightly-linux-amd64 - repo: gitea/gitea - build_args: - - GOPROXY=https://goproxy.io - password: - from_secret: docker_password - username: - from_secret: docker_username - environment: - PLUGIN_MIRROR: - from_secret: plugin_mirror - DOCKER_BUILDKIT: 1 - when: - event: - exclude: - - pull_request - - - name: publish-rootless - image: plugins/docker:latest - settings: - dockerfile: Dockerfile.rootless - auto_tag: false - tags: nightly-linux-amd64-rootless - repo: gitea/gitea - build_args: - - GOPROXY=https://goproxy.io - password: - from_secret: docker_password - username: - from_secret: docker_username - environment: - PLUGIN_MIRROR: - from_secret: plugin_mirror - DOCKER_BUILDKIT: 1 - when: - event: - exclude: - - pull_request - ---- -kind: pipeline -name: docker-linux-amd64-release-branch - -platform: - os: linux - arch: amd64 - -trigger: - ref: - - "refs/heads/release/v*" - -steps: - - name: fetch-tags - image: docker:git - pull: always - commands: - - git fetch --tags --force - - - name: publish - image: plugins/docker:latest - pull: always - settings: - auto_tag: false - tags: ${DRONE_BRANCH##release/v}-nightly-linux-amd64 - repo: gitea/gitea - build_args: - - GOPROXY=https://goproxy.io - password: - from_secret: docker_password - username: - from_secret: docker_username - environment: - PLUGIN_MIRROR: - from_secret: plugin_mirror - DOCKER_BUILDKIT: 1 - when: - event: - exclude: - - pull_request - - - name: publish-rootless - image: plugins/docker:latest - settings: - dockerfile: Dockerfile.rootless - auto_tag: false - tags: ${DRONE_BRANCH##release/v}-nightly-linux-amd64-rootless - repo: gitea/gitea - build_args: - - GOPROXY=https://goproxy.io - password: - from_secret: docker_password - username: - from_secret: docker_username - environment: - PLUGIN_MIRROR: - from_secret: plugin_mirror - DOCKER_BUILDKIT: 1 - when: - event: - exclude: - - pull_request - --- kind: pipeline type: docker @@ -506,136 +379,6 @@ steps: exclude: - pull_request ---- -kind: pipeline -type: docker -name: docker-linux-arm64-release - -platform: - os: linux - arch: arm64 - -trigger: - ref: - - refs/heads/main - paths: - exclude: - - "docs/**" - -steps: - - name: fetch-tags - image: docker:git - pull: always - commands: - - git fetch --tags --force - - - name: publish - image: plugins/docker:latest - pull: always - settings: - auto_tag: false - tags: nightly-linux-arm64 - repo: gitea/gitea - build_args: - - GOPROXY=https://goproxy.io - password: - from_secret: docker_password - username: - from_secret: docker_username - environment: - PLUGIN_MIRROR: - from_secret: plugin_mirror - DOCKER_BUILDKIT: 1 - when: - event: - exclude: - - pull_request - - - name: publish-rootless - image: plugins/docker:latest - settings: - dockerfile: Dockerfile.rootless - auto_tag: false - tags: nightly-linux-arm64-rootless - repo: gitea/gitea - build_args: - - GOPROXY=https://goproxy.io - password: - from_secret: docker_password - username: - from_secret: docker_username - environment: - PLUGIN_MIRROR: - from_secret: plugin_mirror - DOCKER_BUILDKIT: 1 - when: - event: - exclude: - - pull_request - ---- -kind: pipeline -name: docker-linux-arm64-release-branch - -platform: - os: linux - arch: arm64 - -trigger: - ref: - - "refs/heads/release/v*" - -steps: - - name: fetch-tags - image: docker:git - pull: always - commands: - - git fetch --tags --force - - - name: publish - image: plugins/docker:latest - pull: always - settings: - auto_tag: false - tags: ${DRONE_BRANCH##release/v}-nightly-linux-arm64 - repo: gitea/gitea - build_args: - - GOPROXY=https://goproxy.io - password: - from_secret: docker_password - username: - from_secret: docker_username - environment: - PLUGIN_MIRROR: - from_secret: plugin_mirror - DOCKER_BUILDKIT: 1 - when: - event: - exclude: - - pull_request - - - name: publish-rootless - image: plugins/docker:latest - settings: - dockerfile: Dockerfile.rootless - auto_tag: false - tags: ${DRONE_BRANCH##release/v}-nightly-linux-arm64-rootless - repo: gitea/gitea - build_args: - - GOPROXY=https://goproxy.io - password: - from_secret: docker_password - username: - from_secret: docker_username - environment: - PLUGIN_MIRROR: - from_secret: plugin_mirror - DOCKER_BUILDKIT: 1 - when: - event: - exclude: - - pull_request - --- kind: pipeline type: docker @@ -681,50 +424,3 @@ depends_on: - docker-linux-amd64-release-candidate-version - docker-linux-arm64-release-version - docker-linux-arm64-release-candidate-version - ---- -kind: pipeline -type: docker -name: docker-manifest - -platform: - os: linux - arch: amd64 - -steps: - - name: manifest-rootless - image: plugins/manifest - pull: always - settings: - auto_tag: false - ignore_missing: true - spec: docker/manifest.rootless.tmpl - password: - from_secret: docker_password - username: - from_secret: docker_username - - - name: manifest - image: plugins/manifest - settings: - auto_tag: false - ignore_missing: true - spec: docker/manifest.tmpl - password: - from_secret: docker_password - username: - from_secret: docker_username - -trigger: - ref: - - refs/heads/main - - "refs/heads/release/v*" - paths: - exclude: - - "docs/**" - -depends_on: - - docker-linux-amd64-release - - docker-linux-arm64-release - - docker-linux-amd64-release-branch - - docker-linux-arm64-release-branch diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index 4281c2ca0..71ec6dae8 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -55,5 +55,33 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: docker/setup-buildx-action@v1 - # build for linux/amd64, and linux/arm64 (possibly include linux/arm/v7 later. not included now because it adds significant amount to the build time) + - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-buildx-action@v2 + - name: Get cleaned branch name + id: clean_name + run: | + # if main then say nightly otherwise cleanup name + if [ "${{ github.ref }}" = "refs/heads/main" ]; then + echo "branch=nightly" >> "$GITHUB_OUTPUT" + exit 0 + fi + REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//') + echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT" + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: build rootful docker image + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: gitea/gitea:${{ steps.clean_name.outputs.branch }} + - name: build rootless docker image + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64,linux/arm64 + push: true + file: Dockerfile.rootless + tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless