Trigger a pipeline dependes on Open a PR and the later push to the open PR - continuous-integration

What is needed?
The pipeline is deploy the resources to the development environment for testing. The pipeline shall be triggered when a PR is opened that a feature branch want to merge to the development branch. Trigger the pipeline by open the PR is easy. However, things are not always going well for the first try. things may need to be changed after code review and a new commit is needed.
Issue:
But how to trigger the pipeline when the new commit is pushed to the un-merged feature branch? would the edited type below do the trick?
on:
pull_request:
types: [opened, reopened, edited]

You should add the synchronize type, as example:
on:
pull_request:
types: [opened, reopened, edited, synchronize]
See also https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request

Related

Avoid Gitlab-CI build for develop branch on finish release (git-flow)

We are using Git-Flow with automatic builds and releases using Gitlab-CI.
Every commit on the develop branch triggers the build stage.
Every commit on the master branch triggers first the build stage and then the release stage (which uses the artifacts from the build stage).
This works fine, there is only one drawback for which I couldn't find a solution:
Whenever we finish a release in the git repository, this means commits on both develop and master branch. That also triggers the build stage on both branches, building from the exact same source versions (at this point there are two different commits that contain the exact same code).
I would like to avoid the build on the development branch, but only in this special case.
I don't think this is possible using the logic inside .gitlab-ci.yml, but that's ok. I would be glad if I could recognize this situation and end the build script early.
I think this means the following conditions have all to be met:
We are on the develop branch. (simple)
The current commit was merged from both master and develop.
The merged master commit has a tag attached to it.
What git magic could I do to recognize if this is the case for a certain commit in the develop branch?
I am using Python for this, but I would appreciate helpful answers in any programming language :-)
maybe you can use only in gitlab-ci.yml
deploy-dev:
stage: deploy-dev
script:
- ./somescript.sh
only:
refs:
- develop
deploy-prod:
stage: deploy-prod
script:
- ./somescript.sh
only:
refs:
- master
- tags

Jenkins pipeline triggered for all branches on code commit in Develop branch

Can anyone help me with any solution for the below issue:
My developer is pushing the code in Dev branch of Bitbucket but in Jenkins, it triggers Dev, Test, Stage and Prod pipeline though there are no changes deployed in Other branches and it simply redeploys the last commit in Test, Stage, and Prod. But then why should any code push to the DEV branch trigger another pipeline.
Please note that every env pipeline is only checking out the respective env branch for deployment. I had raised this issue with the Bitbucket community as well but they confirmed that no issues are seen from Bitbucket's end and suggested to check from Jenkins's end.
In my Jenkins, every pipeline is triggered based on "Build whenever a change is pushed to Bitbucket"
Multi-branch Pipeline should be the way to go here. Makes your file much easier.
Alternative would be to write a script block in your declarative pipelines (or write scripted pipeline directly) which would evaluate the git.branch env variable and only run the job when the branch is correct.
This would work and be somewhat maintainable when you have a fixed set of branches. If you have dev-s creating new branches here and there then this would become overwhelming very fast.

Merge changes from one branch and ignore other dormant changes

I have a scenario, where two developers are working parallel in a same branch of TFVC. Developer A and Developer B checked in from their respective branches and committed file changes.
Is there any work around to push only dev A's changes on the server and keep dev B's changes dormant?
Any help would be much appreciated. Thanks in advance
You could try creating a branch(V1) from main branch, remove changes of the developer which shouldnot go to deployment from V1 and deploy V1.
https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/branching-strategies-with-tfvc?view=azure-devops
I will suggest you to switch to Git as it more user friendly. Resources and help are easily and readily available for GIT
https://www.nebbiatech.com/2017/06/22/choosing-git-tfvc-vsts/

Are Parent-Child CI triggers possible in VSTS

So while this is completely do-able (albeit using some fairly fancy scripting) in Jenkins, I'm just wondering if it's do-able in VSTS.
I'm not too familiar with capabilities of VSTS (have read https://learn.microsoft.com/en-us/vsts/build-release/actions/ci-build-git).
I want all changes pushed from a feature branch to master to be automatically merged into all other active feature branches. So basically, I want (what I call) true CI.
Is this possible in VSTS, and if so, how would I do it?
EDIT 1:
Read this:
https://learn.microsoft.com/en-us/vsts/build-release/actions/scripts/git-commands#merge-a-feature-branch-to-master
This would work for me by simply switching the merge direction; instead of merging from feature branch to master, merge from master to feature branch.
So the question now becomes:
How to get a list of all active child branches?
Given that I'll be using work items mapped to branches, would this suffice?
https://learn.microsoft.com/en-us/vsts/report/extend-analytics/work-item-links
No, it is not supported in VSTS, with Pull Request it just can merge source branch to a target branch.
The workaround is that you can create the Pull Requests for related branches during the build/release, refer to this thread for detail steps:
How can I create a Pull Request when a release completes in VSTS?
Update:
The other way is calling git command to merge branches: Merge a feature branch to master
Regarding active branch, as we discussed, you can link them to a work item, the work item has the TO DO, In Progress etc... states that can identify different "state" of branches, and you can retrieve the work item through Work Item REST API.

Get checkin comments for changelog with merging of the Development branch to Acceptance

We have a Team Foundation Server with 3 branches on it:
Development
Acceptence
Production
When we want to update our production server we first merge all changes from the Development-branch to Acceptence-branch then upload the Acceptence-branch to our Test-server. After all is tested and approved we merge the new changes from the Acceptence-branch to the Production-branch. Then upload this version to the production server.
Now for my question:
When we merge the Development-branch to the Acceptence-branch we would like to see what changes have been merged. When we check-in a new change to the Development-branch, we comment our check-in so we can see who did what. And I would like to see these comments when merging to the acceptence branch.
How can I do this?
Integrate the BuildReport workflow activity of the Community TFS Build Extensions or
TFS Change Log.
Colin Dembovsky has created a custom Build Activity that will automatically associate the original changesets (and work items!) with a CI build that would be triggered by merging into Acceptance or Production branches.
See all the details and download the binaries here: Colins ALM Corner

Resources