From 496784ab43f83c0d77cfbd8e6f30e915ccb05a1d Mon Sep 17 00:00:00 2001 From: OCram85 Date: Sun, 12 Nov 2023 11:46:01 +0100 Subject: [PATCH] avoid duplicate ci runs (#73) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### :book: Summary #### :bookmark_tabs: Test Plan > :bulb: Select your test plan for the code changes. | Choice | Test Method | | :----: | :----------- | | ✅ | CI pipeline tests | | | Custom test | | | No test plan | ##### Details / Justification #### :books: Additional Notes Reviewed-on: https://gitea.ocram85.com/CodeServer/arkanum/pulls/73 Co-authored-by: OCram85 Co-committed-by: OCram85 --- .woodpecker/{deploy.yml => .ci.yml} | 58 +++++++++++++++++++++++------ .woodpecker/next.yml | 57 ---------------------------- .woodpecker/test.yml | 12 ------ 3 files changed, 46 insertions(+), 81 deletions(-) rename .woodpecker/{deploy.yml => .ci.yml} (60%) delete mode 100644 .woodpecker/next.yml delete mode 100644 .woodpecker/test.yml diff --git a/.woodpecker/deploy.yml b/.woodpecker/.ci.yml similarity index 60% rename from .woodpecker/deploy.yml rename to .woodpecker/.ci.yml index b125443..e9531d3 100644 --- a/.woodpecker/deploy.yml +++ b/.woodpecker/.ci.yml @@ -1,7 +1,11 @@ -depends_on: - - test +when: + - event: [pull_request, tag, cron] + - event: push + branch: + - ${CI_REPO_DEFAULT_BRANCH} variables: + - &build_plugin 'woodpeckerci/plugin-docker-buildx:2.2.0' # deployment targets - &publish_repos 'ocram85/arkanum,gitea.ocram85.com/codeserver/arkanum,ghcr.io/ocram85/arkanum,codeberg.org/codeserver/arkanum' # logins for deployment targets @@ -31,35 +35,64 @@ variables: password: from_secret: codeberg_passwd + steps: - latest: - image: woodpeckerci/plugin-docker-buildx:2 + test: + image: *build_plugin + settings: + dry_run: true + registry: gitea.ocram85.com + repo: test + dockerfile: Dockerfile + platforms: linux/amd64 + auto_tag: true + build_args: + - VERSION=${CI_COMMIT_TAG:-PR ${CI_COMMIT_PULL_REQUEST}} + - TAG=${CI_COMMIT_TAG} + when: + event: pull_request + branch: ${CI_REPO_DEFAULT_BRANCH} + + publish: + image: *build_plugin settings: repo: *publish_repos dockerfile: Dockerfile + platforms: linux/amd64 auto_tag: true logins: *publish_logins build_args: - VERSION=${CI_COMMIT_TAG:-PR ${CI_COMMIT_PULL_REQUEST}} - TAG=${CI_COMMIT_TAG} when: - event: push - branch: master + event: [push, tag, cron] + branch: ${CI_REPO_DEFAULT_BRANCH} - release: - image: woodpeckerci/plugin-docker-buildx:2 + build-next: + image: *build_plugin settings: repo: *publish_repos dockerfile: Dockerfile - auto_tag: true + platforms: linux/amd64 + tag: next logins: *publish_logins build_args: - VERSION=${CI_COMMIT_TAG:-PR ${CI_COMMIT_PULL_REQUEST}} - TAG=${CI_COMMIT_TAG} when: - event: tag + event: [pull_request] - GiteaRelease: + triggerPortainer: + image: ocram85/portainer-serviceupdate + settings: + VERBOSE: true + URI: "https://portainer.ocram85.com" + TOKEN: + from_secret: NEXT_TOKEN + when: + event: [pull_request] + + gitea-release: image: plugins/gitea-release settings: api_key: @@ -68,4 +101,5 @@ steps: title: ${CI_COMMIT_TAG} note: "> :bulb: **Note:** See [CHANGELOG.md](src/branch/master/CHANGELOG.md) for recent changes." when: - event: tag + event: [tag] + branch: ${CI_REPO_DEFAULT_BRANCH} diff --git a/.woodpecker/next.yml b/.woodpecker/next.yml deleted file mode 100644 index 91eba06..0000000 --- a/.woodpecker/next.yml +++ /dev/null @@ -1,57 +0,0 @@ -depends_on: - - test - -when: - event: pull_request - -variables: - # deployment targets - - &publish_repos 'ocram85/arkanum,gitea.ocram85.com/codeserver/arkanum,ghcr.io/ocram85/arkanum,codeberg.org/codeserver/arkanum' - # logins for deployment targets - - publish_logins: &publish_logins - # Default DockerHub login - - registry: https://index.docker.io/v1/ - username: - from_secret: docker_user - password: - from_secret: docker_passwd - # Additional Quay.IO login - - registry: https://gitea.ocram85.com - username: - from_secret: gitea_user - password: - from_secret: gitea_passwd - # GitHub Container Registry - - registry: https://ghcr.io - username: - from_secret: github_user - password: - from_secret: github_passwd - # Codeberg - - registry: https://codeberg.org - username: - from_secret: codeberg_user - password: - from_secret: codeberg_passwd - -steps: - buildTestImage: - image: woodpeckerci/plugin-docker-buildx:2 - settings: - #dry_run: true - repo: *publish_repos - dockerfile: Dockerfile - platforms: linux/amd64 - tag: next - logins: *publish_logins - build_args: - - VERSION=${CI_COMMIT_TAG:-PR ${CI_COMMIT_PULL_REQUEST}} - - TAG=${CI_COMMIT_TAG} - - triggerPortainer: - image: ocram85/portainer-serviceupdate - settings: - VERBOSE: true - URI: "https://portainer.ocram85.com" - TOKEN: - from_secret: NEXT_TOKEN diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml deleted file mode 100644 index d6b3551..0000000 --- a/.woodpecker/test.yml +++ /dev/null @@ -1,12 +0,0 @@ -steps: - testDockerfile: - image: woodpeckerci/plugin-docker-buildx - settings: - dry_run: true - registry: gitea.ocram85.com - repo: gitea.ocram85.com/codeserver/arkanum - dockerfile: Dockerfile - tags: next - build_args: - - VERSION=${CI_COMMIT_TAG:-PR ${CI_COMMIT_PULL_REQUEST}} - - TAG=${CI_COMMIT_TAG}