How to use one sourceode checkout for all the Bamboo stages? - bamboo

I am planning to create 4 stages
Source code checkout stages
Build for dev env stages
Build for uat env stages
Build for Prod env stages
Is it possible to use the same source code check out for all the stages? How?

This is actually straight forward:
Define your repository in the Repository tab of the plan configuration
Add a Sourcecode Checkout task for each build job in the plan.
By virtue of the repository definition for the plan, a consistent snapshot at the time the plan was started, will be used for the checkout tasks i.e. they will each fetch the same code.
This is not clearly documented in the Bamboo docs but is discussed here https://answers.atlassian.com/questions/33651/stages-and-artifact-passing

Above answer works, but I think you should not build same branch with all environments. It might be better to use better branching workflow,so that you can easily deploy correct change to required environment.

Related

Bazel - Should you use the same GCS bucket as remote cache for master and feature branches?

I just started using Bazel for our team's GitLab CI pipeline, so I wonder if we could use the same GCS bucket as remote cache for master and feature branches.
My thinking is that it could lead to a race condition if the cache is updated by 2 build job simultaneously. One more scenario is creating docker image right after a build job: it could put the wrong binaries into the Docker image.
Could anyone correct me on that? Any help would be much appreciated.
Bazel has reproducible builds, so you can be sure that when branches share some code it's identical.
It is possible (although unlikely) that you build the same part twice, but since both builds should give the same result it doesn't matter.

How to override the default plan branch configuration?

Currently we are in the process of migrating our projects from jenkins to bamboo. In this process, I am looking for an option in bamboo plan for a plan branch to be created when a new branch is created in the bitbucket repo and also when pull request is created.
As I see in the branch configuration of a plan, it is possible only to choose one option (new branch or pull request) for plan branch. is there any way where i can choose both options? Can I override the configuration using shell script? our bamboo server is currently running version 6.10.
Bamboo doesn't support multiple options for plan branch creation. What's the reason to have both options?
Before you create PR VCS branch already exists so why option to create plan branch on Bitbucket branch creation is not enough?

Gitlab pipeline cache not being shared due to different runners

I have a simple Gitlab pipeline setup with two stages: build & test. Both stages are supposed to share cached files but they don't appear to, resulting in the test stage failing. As best I can, the problem is that each stage uses a different runner and the cached files use the runner ID as part of the path.
.gitlab-ci.ym
...
cache:
key: "build"
untracked: true
...
The build stage outputs the following
Creating cache build...
untracked: found 787 files
Uploading cache.zip to https://runners-cache-1.gitlab.com:443/runner/runner/30dcea4b/project/1704442/build
The test stage outputs the following
Checking cache for build...
$ mvn test
I believe this means the cache was NOT found because there is no download information; but it's not clear.
I can also see that each stage uses a different runner and since the runner ID is part of the cache path, I suspect that is the problem.
I need to either use the same runner for each stage or share the cache across runners. I don't understand how to do either.
Any help would be appreciated.
It appears the cache feature is appropriately named, it's only for improving build performance and is not guaranteed to have the data, much like a real cache.
The correct approach is to use artifacts with dependencies.

How to select the particular repository in bamboo during build?

I am new to use the bamboo server. In the application, i have multiple branches, during the build time, it is possible to normal user to select the particular branch to build other than default repository.
Thanks in advance
You can use plan branches to build for specific or all branches. See https://confluence.atlassian.com/display/BAMBOO/Using+plan+branches for more details.

How can I tell Hudson to build the modules instead of the jobs?

I have a alot of jobs on Hudson, most of which are really small and consist of just a few modules. But one is big and consist of several modules.
When ever I make a commit to our subversion repository for any of those several modules in that big job, Hudson builds the entire job instead of just the module that have changed.
It doesn't matter if I just scm-polling or a subversion hook, the result is the same.
It seems to me like it would be better if the modules where built instead of the jobs since the other modules in other jobs have dependencies to the modules and not to the jobs.
Can this be configured or do I have to create several jobs instead of the big one? And if so, can I configure the big job to never build when any of it's modules are being triggered but still build when it's own pom.xml is changed?
Thanks.
Hudson has an "Incremental Build" option in the Maven area of the job configuration.
It's hidden in the "Advanced" area.
You could make use of the reactor plugin. For example:
mvn reactor:make-scm-changes
This will only build those modules that have been changed in the SCM. Follow the link for other examples.
Doesn't your compiler offers you the incremental compile option? The java 1.6 compiler usually searches for class and source files and decides using the timestamp to determine whether to use the source or class file. Just leave out the clean goal when building your code.
Another option would be to first run a batch/shell script to determine what files changed and delete the corresponding class files so that the compiler incrementally builds the class files that are missing.