fix: circle ci improvements to run release only on tag filtering, and builds based on path filtering (#23)

This commit is contained in:
Jacob Elias 2024-06-28 18:37:10 -05:00 committed by GitHub
parent d7aab1df42
commit ec496f559b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 16 deletions

@ -4,7 +4,7 @@ version: 2.1
setup: true setup: true
orbs: orbs:
path-filtering: circleci/path-filtering@0.1.1 path-filtering: circleci/path-filtering@1.0.0
workflows: workflows:
check-updated-files: check-updated-files:
@ -20,6 +20,9 @@ workflows:
proxyd/.* run-build-proxyd true proxyd/.* run-build-proxyd true
.circleci/.* run-all true .circleci/.* run-all true
.github/.* run-all true .github/.* run-all true
filters:
tags:
only: /.*/
base-revision: main base-revision: main
# this is the path of the configuration we should trigger once # this is the path of the configuration we should trigger once

@ -4,7 +4,7 @@ orbs:
go: circleci/go@1.9.0 go: circleci/go@1.9.0
gcp-cli: circleci/gcp-cli@2.4.1 gcp-cli: circleci/gcp-cli@2.4.1
shellcheck: circleci/shellcheck@3.1.2 shellcheck: circleci/shellcheck@3.1.2
path-filtering: circleci/path-filtering@0.1.1 path-filtering: circleci/path-filtering@1.0.0
parameters: parameters:
run-build-op-conductor-mon: run-build-op-conductor-mon:
@ -67,6 +67,8 @@ jobs:
log-config-results: log-config-results:
docker: docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest # only used to enable codecov. - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest # only used to enable codecov.
environment:
CURRENT_TAG: << pipeline.git.tag >>
steps: steps:
- checkout - checkout
- run: - run:
@ -83,7 +85,6 @@ jobs:
echo "Is not a scheduled pipeline: $([ "<< pipeline.trigger_source >>" != "scheduled_pipeline" ] && echo "true" || echo "false")" echo "Is not a scheduled pipeline: $([ "<< pipeline.trigger_source >>" != "scheduled_pipeline" ] && echo "true" || echo "false")"
echo "" echo ""
echo "Tag Information:" echo "Tag Information:"
CURRENT_TAG=$(git describe --tags --exact-match 2> /dev/null || echo "No tag")
echo "Current tag: $CURRENT_TAG" echo "Current tag: $CURRENT_TAG"
# Use the same regex patterns as defined in the YAML anchors # Use the same regex patterns as defined in the YAML anchors
@ -385,7 +386,12 @@ jobs:
workflows: workflows:
logging: logging:
jobs: jobs:
- log-config-results - log-config-results:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
op-conductor-mon: op-conductor-mon:
when: when:
or: [<< pipeline.parameters.run-build-op-conductor-mon >>, << pipeline.parameters.run-all >>] or: [<< pipeline.parameters.run-build-op-conductor-mon >>, << pipeline.parameters.run-all >>]
@ -435,10 +441,13 @@ workflows:
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>> docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
docker_context: . docker_context: .
release: release:
when:
not:
equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
jobs: jobs:
- log-config-results:
filters:
tags:
only: /^(proxyd|ufm-[a-z0-9\-]*|op-[a-z0-9\-]*)\/v.*/
branches:
ignore: /.*/
- hold: - hold:
type: approval type: approval
filters: filters:
@ -451,8 +460,6 @@ workflows:
filters: filters:
tags: tags:
only: /^op-ufm\/v.*/ only: /^op-ufm\/v.*/
branches:
ignore: /.*/
docker_name: op-ufm docker_name: op-ufm
docker_tags: <<pipeline.git.revision>> docker_tags: <<pipeline.git.revision>>
docker_context: . docker_context: .
@ -466,17 +473,14 @@ workflows:
docker_name: op-ufm docker_name: op-ufm
docker_tags: <<pipeline.git.revision>> docker_tags: <<pipeline.git.revision>>
context: context:
- oplabs-gcr - oplabs-gcr-release
requires: requires:
- op-ufm-docker-build - op-ufm-docker-build
- docker-build: - docker-build:
name: proxyd-docker-build name: proxyd-docker-build
filters: filters:
tags: tags:
only: /^proxyd\/v.*/ only: /^proxyd\/v.*/
branches:
ignore: /.*/
docker_name: proxyd docker_name: proxyd
docker_tags: <<pipeline.git.revision>> docker_tags: <<pipeline.git.revision>>
docker_context: . docker_context: .
@ -490,8 +494,6 @@ workflows:
filters: filters:
tags: tags:
only: /^proxyd\/v.*/ only: /^proxyd\/v.*/
branches:
ignore: /.*/
docker_name: proxyd docker_name: proxyd
docker_tags: <<pipeline.git.revision>> docker_tags: <<pipeline.git.revision>>
context: context:
@ -501,10 +503,15 @@ workflows:
- docker-build: - docker-build:
name: op-conductor-mon-docker-build name: op-conductor-mon-docker-build
filters:
tags:
only: /^op-conductor-mon\/v.*/
docker_file: op-conductor-mon/Dockerfile docker_file: op-conductor-mon/Dockerfile
docker_name: op-conductor-mon docker_name: op-conductor-mon
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>> docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
docker_context: . docker_context: .
context:
- oplabs-gcr-release
requires: requires:
- hold - hold
- docker-publish: - docker-publish:
@ -512,6 +519,6 @@ workflows:
docker_name: op-conductor-mon docker_name: op-conductor-mon
docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>> docker_tags: <<pipeline.git.revision>>,<<pipeline.git.branch>>
context: context:
- oplabs-gcr - oplabs-gcr-release
requires: requires:
- op-conductor-mon-docker-build - op-conductor-mon-docker-build