Bamboo build YAML: Trigger build via cron on specific BitBucket Git branch only - bamboo

I have a project's code on BitBucket Git repo. At the moment Bamboo executes YAML-based Build Plan successfully with every commit, on every Git branch.
Now I want to add another trigger to let Bamboo execute build of only master branch once a week. I've tried by adding this YAML lines:
triggers:
- remote
- cron:
expression: 0 30 8 ? * WED
BUT: Bamboo seems to take code from that Git branch he executes the last build on. So for instance, if I commit code to branch foo the afternoon before Wednesday morning,
Bamboo executes build of code from this branch foo immediately after the commit, which is fine and expected. But Bamboo also triggers build of this branch foo at 8:30 am on Wednesday.
How do I tell Bamboo YAML file to launch build of master branch code every Wednesday morning?
Thanks
Christian
PS: Bamboo version 8.1.1.

Seems I've found a solution:
branch-overrides:
- master: # Modification of steps/triggers to apply with Git master branch builds only!
triggers:
- polling: # Launch job every wednesday morning
cron: 0 30 8 ? * WED
Unfortunately, this modification of bamboo.yml itself does not trigger a build, nor does it launch the job on next wednesday! At least according to my experience, you have to commit "something else" (like source code files) to get Bamboo recognize your wish to launch build of master branch every wednesday morning.
Christian
Update on wednesday, 2022-05-25: Doesn't work for unknown reasons, I think cron expression should make Bamboo launch build this morning, but it doesn't happen.
Weird.

Related

gitflow maven plugin build error in gitlab-CI

Good afternoon, I use the gitflow maven plugin to set up automatic version number change when building a project in gitlab-CI, I set it up according to the article https://viesure.io/automating-semantic-versioning-with-maven/. I make local changes in the development branch, do push, manually launch the release job, the job works correctly. I make changes locally in the development branch again, push, run the same release job manually, and the job crashes with an error
[ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.13.0:release (default-cli) on project gs-maven: release: Remote branch 'origin/development' is ahead of the local branch 'development'. Execute git pull
I can’t understand where my data is getting out of sync, I tried to do git pull after the first run of the job (I did it locally), but the error still occurs. What am I doing wrong?

Gitlab CI - Trigger daily pipeline only if new chanes have been commited

The company I work for has a self hosted Gitlab CE server v13.2.1.
For a specific project I've setup the CI jobs to build according to the following workflow :
If a commit has been pushed to the main branch
If a merge request has been created
If a tag has been pushed
Every day at midnight to build the main branch (using scheduled pipelines)
Everything works fine. The only thing I would like to improve is that the nightly builds are performed even if the main branch has not been modified (no new commit).
I had a look to the Gitlab documentation to change my workflow: rules in the .gitlab-ci.yml file but I didn't find anything relevant.
The gitlab runner is installed in a VM and is setup as a shell executor. I was thinking of creating in the home directory a file to store the last commit ID. I'm not a big fan of that solution, because :
it's a ugly fix.
The pipeline will be triggered by Gitlab even if it does nothing. This will pollute the pipeline list.
Is there any way to setup the workflow: section to perform this so the pipeline list won't contain unnecessary pipeline ?

How to interrupt triggered gitlab pipelines

I'm using a webhook to trigger my Gitlab pipeline. Sometimes, this trigger is triggered a bunch of times, but my pipelines only has to run the last one (static site generation). Right now, it will run as many pipelines as I have triggered. My pipelines takes 20 minutes so sometimes it's running the rest of the day, which is completely unnecessary.
https://docs.gitlab.com/ee/ci/yaml/#interruptible and https://docs.gitlab.com/ee/user/project/pipelines/settings.html#auto-cancel-pending-pipelines only work on pushed commits, not on triggers
A similar problem is discussed in gitlab-org/gitlab-foss issue 41560
Example of a use-case:
I want to always push the same Docker "image:tag", for example: "myapp:dev-CI". The idea is that "myapp:dev-CI" should always be the latest Docker image of the application that matches the HEAD of the develop branch.
However if 2 commits are pushed, then 2 pipelines are triggered and executed in paralell. Then the latest triggered pipeline often finishes before the oldest one.
As a consequence the pushed Docker image is not the latest one.
Proposition:
As a workaround for *nix you can get running pipelines from API and wait until they finished or cancel them with the same API.
In the example below script checks for running pipelines with lower id's for the same branch and sleeps.
jq package is required for this code to work.
Or:
Create a new runner instance
Configure it to run jobs marked as deploy with concurrency 1
Add the deploy tag to your CD job.
It's now impossible for two deploy jobs to run concurrently.
To guard against a situation where an older pipeline may run after a new one, add a check in your deploy job to exit if the current pipeline ID is less than the current deployment.
Slight modification:
For me, one slight change: I kept the global concurrency setting the same (8 runners on my machine so concurrency: 8).
But, I tagged one of the runners with deploy and added limit: 1 to its config.
I then updated my .gitlab-ci.yml to use the deploy tag in my deploy job.
Works perfectly: my code_tests job can run simultaneously on 7 runners but deploy is "single threaded" and any other deploy jobs go into pending state until that runner is freed up.

How to disable simultaneous build on drone io?

I use drone as CI and want to know how I can disable simultaneous build. What's happening is that when I submit two commits to git repo, drone will trigger two build on each of the submit. How can I let the second build wait until the first one finish?
Regarding the open source version of Drone: set the DOCKER_MAX_PROCS environment variable of your drone agent to 1, i.e. docker run -e DOCKER_MAX_PROCS=1 [...] drone/drone:0.5 agent. The agent will run one build concurrently, other builds will queue up.
See the Installation Reference section in the readme for more info.

Atlassian Bamboo: First plan with a simple job of downloading a local git repo

I just downloaded the free trial of Bamboo continuous integration server, and created the first plan with nothing but downloading the source code from the git. I have a local git repository on the bamboo machine so the git URL is pointing to a local path.
The problem is that when I run the job, it never finishes even after waiting for an hour. This is the last lines of the activity log:
07-Apr-2011 20:03:23 Checking out revision f9dc82500914333ed4bbdae5ed038771fd658c3c.
07-Apr-2011 20:03:23 Creating local git repository in '/home/bob/bamboo-home/xml-data/build-dir/DEV-DEV-1/.git'.
From the shell I can go to the directory shown in the log and see that the source code were cloned correctly to the bamboo working directory. But the job will never finish and the log will not have any more update from here. I have to manually terminate the job. Any ideas? Do I miss something?
Just a guess, since the Bamboo instance we have at work pulls from Accurev and not Git, and I've never run into this problem myself - but it may be hung because there isn't a builder defined for that plan. You might try defining a builder (even if it's one that you know will fail) just to see if it makes it to that next step.
I had very similar problem.
It's not very original solution but I just uninstalled bamboo and installed it again.. Now it works now