Comments (6)
I am using pipeline and was wondering how I can trigger off builds from multibranch pipeline project but some reason I cannot get the value for CHANGE_ID for a branch that has a pending pull request active. I use a Jenkins file that is stored in the repo and I was looking to trigger off builds using the code in the Jenkins file which needs to detect the pull request using CHANGE_ID. I tried using sh " echo env.CHANGE_ID" but this returns null. However I do get a value for sh "echo env.BRANCH_NAME".
from percy-client.
Hey @jonesetc — thanks for this info, very helpful.
Before we update this and our other client libraries to natively support it, can you use our override variables to make sure things work in your Pipeline Plugin environment?
export PERCY_PULL_REQUEST="$CHANGE_ID"
export PERCY_BRANCH ="$BRANCH_NAME"
If the commit SHA is no longer stored in GIT_COMMIT
, you'll also need to export PERCY_COMMIT="$SOME_PIPELINE_ENV_VAR_FOR_COMMIT_SHA"
If that works for you, we can update our libraries to check if Pipeline is used vs. GHPRB.
from percy-client.
Thanks for the quick response.
Setting PERCY_BRANCH
to $BRANCH_NAME
works and is what we started doing to work around our issue of master builds not being recognized as such. I will do a little bit of testing to set those other two variables and make sure.
I'm guessing that if PERCY_PULL_REQUEST
is set correctly, the UI for the build will have a link back to that PR?
from percy-client.
Yup!
from percy-client.
So, I did a little bit of testing, and here's the general information:
BRANCH_NAME
is a replacement forghprbTargetBranch
, and is always availableCHANGE_ID
is a replacement forghprbPullId
, but is not always available- The Pipeline Plugin can be configured to build all branches, not just PRs, and as such does not usually have this set on the env
- There is no available variable that serves the same information as
GIT_COMMIT
, so it would require the fallback to parsing rawgit
output- The Pipeline Plugin is built abstractly from all SCM systems, so specific things like commits are not available in the environment
- The commit hash is available elsewhere to the user, but would still require the user to manually set it on the environment
I'd be happy to make a PR for this that would basically:
- Add a new
current_ci
tag called:jenkins-pipeline
_commit_sha
would still fall through and use the_raw_commit_output('HEAD')
branch
would useENV['BRANCH_NAME']
pull_request_number
would useENV['CHANGE_ID']
if available
from percy-client.
👍 Sounds good to us, @jonesetc! Thanks for doing that research as well.
from percy-client.
Related Issues (9)
- Does not wrap Faraday::TimeoutError HOT 1
- invalid byte sequence in US-ASCII HOT 32
- With auto diff base, Percy will use any PR branch that happens to be named `master` as the baseline HOT 6
- Consider providing a way to specify the baseline SHA for a Percy build HOT 5
- Percy <-> Github integration is not picking up the latest Percy build for a PR, thereby blocking it from being merged HOT 6
- Percy::Config option for ignoring build resources? HOT 6
- Github Integration never completes on Percy admin.
- Migrate from /repos to /projects
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from percy-client.