I am using CircleCI to build a project, everything is running fine, except that my tags are not built when pushed to github:
I don't understand why, I have reduced my whole configuration to a minimalistic config file, it's the same logic:
version: 2
jobs:
my_dummy_job_nightly:
working_directory: ~/build
docker:
- image: docker:git
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: true
- run:
name: NIGHTLY BUILD
command: |
apk add --update py-pip
python -m pip install --upgrade pip
my_dummy_job_deploy:
working_directory: ~/build
docker:
- image: docker:git
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: true
- run:
name: RELEASE BUILD
command: |
apk add --update py-pip
python -m pip install --upgrade pip
###################################################################################
# CircleCI WORKFLOWS #
###################################################################################
workflows:
version: 2
build-and-deploy:
jobs:
###################################################################################
# NIGHTLY BUILDS #
###################################################################################
- my_dummy_job_nightly:
filters:
tags:
ignore: /.*/
branches:
only: master
###################################################################################
# TAGS BUILDS #
###################################################################################
- hold:
type: approval
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- my_dummy_job_deploy:
requires:
- hold
filters:
tags:
only: /.*/
branches:
ignore: /.*/
I don't understand why the tags don't build ... The regex should let everything through...
Both CircleCI and GitHub Actions configure jobs in the configuration file using similar syntax. If you configure any dependencies between jobs using requires in your CircleCI workflow, you can use the equivalent GitHub Actions needs syntax.
You can stop building your project on CircleCI at any time, by navigating to the project settings (https://app.circleci.com/settings/project/<vcs>/<org>/<project>) page and clicking the "Stop Building" button.
CircleCI offers free access to compute time and resources for organizations on our Free plan. Open source projects can access up to 400,000 credits per month (equivalent to 80,000 build minutes) to use on Linux, Arm, and Docker.
I have finally found the issue. Nothing to do with the configuration, CircleCI interface do not show tag build in the Workflows Interface and thus the approval
operation block the whole process.
To access the workflow and approve the deployment, you have to click on the build and click on the workflow (see below):
Once on the workflow, it is possible to approve the process:
The only solution I have found to make the build appear is to create a dummy and useless step in the build process that will appear before the approval.
version: 2
jobs:
init_tag_build:
working_directory: ~/build
docker:
- image: docker:git
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: true
- run:
name: Launch Build OP
command: |
echo "start tag workflow"
my_deploy_job:
working_directory: ~/build
docker:
- image: docker:git
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: true
- run:
name: DEPLOY BUILD
command: |
echo "do the deploy work"
workflows:
version: 2
build-and-deploy:
jobs:
- init_tag_build:
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- hold:
type: approval
requires:
- init_tag_build
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- my_deploy_job:
requires:
- hold
filters:
tags:
only: /.*/
branches:
ignore: /.*/
TL;DR
In the yaml you ignore every branch. Remove the following part.
branches:
ignore: /.*/
You probably meant to build only if tags are shown, but you ignored all the branches. If you want to build for every branch with tags remove the line. If you want to build for some branch (e.g. dev) with tags then add branches: only: dev
.
The connection between the two specifier is AND
instead of OR
. There is a discussion on CircleCI forum to add feature to change it to OR
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With