Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ci/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ JOB:
- kibana-ciGroup10
- kibana-ciGroup11
- kibana-ciGroup12
# - kibana-visualRegression
- kibana-visualRegression

# make sure all x-pack-ciGroups are listed in test/scripts/jenkins_xpack_ci_group.sh
- x-pack-firefoxSmoke
Expand All @@ -28,7 +28,7 @@ JOB:
- x-pack-ciGroup8
- x-pack-ciGroup9
- x-pack-ciGroup10
# - x-pack-visualRegression
- x-pack-visualRegression

# `~` is yaml for `null`
exclude: ~
31 changes: 30 additions & 1 deletion src/dev/ci_setup/get_percy_env.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,36 @@ const pkg = require('../../../package.json');
const { stdout: commit } = execa.sync('git', ['rev-parse', 'HEAD']);
const shortCommit = commit.slice(0, 8);

if (!process.env.JOB_NAME) {
throw new Error('getPercyEnv: [JOB_NAME] environment variable required');
}

const isPr = process.env.JOB_NAME.includes('elastic+kibana+pull-request');
if (isPr && !(process.env.PR_TARGET_BRANCH && process.env.PR_SOURCE_BRANCH)) {
throw new Error(
'getPercyEnv: Unable to determine percy environment in prs without [PR_TARGET_BRANCH] and [PR_SOURCE_BRANCH] environment variables'
);
}

let branch;
if (isPr) {
branch = process.env.PR_SOURCE_BRANCH;
} else {
if (!process.env.branch_specifier) {
throw new Error('getPercyEnv: [branch_specifier] environment variable required');
}

branch = process.env.branch_specifier.split('refs/heads/')[1];

if (!branch) {
throw new Error(
`getPercyEnv: [branch_specifier=${process.env.branch_specifier}] must start with 'refs/heads/'`
);
}
}

console.log(`export PERCY_PARALLEL_TOTAL=2;`);
console.log(`export PERCY_PARALLEL_NONCE="${shortCommit}/${isPr ? 'PR' : pkg.branch}/${process.env.BUILD_ID}";`);
console.log(`export PERCY_PARALLEL_NONCE="${shortCommit}/${isPr ? 'PR' : branch}/${process.env.BUILD_ID}";`);
console.log(`export PERCY_BRANCH="${branch}";`);
// percy snapshots always target pkg.branch, so that feature branches can be based on master/7.x/etc.
console.log(`export PERCY_TARGET_BRANCH="${isPr ? process.env.PR_TARGET_BRANCH : pkg.branch}";`);
2 changes: 2 additions & 0 deletions src/dev/ci_setup/setup_percy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ export PUPPETEER_EXECUTABLE_PATH
eval "$(node ./src/dev/ci_setup/get_percy_env)"
echo " -- PERCY_PARALLEL_NONCE='$PERCY_PARALLEL_NONCE'"
echo " -- PERCY_PARALLEL_TOTAL='$PERCY_PARALLEL_TOTAL'"
echo " -- PERCY_BRANCH='$PERCY_BRANCH'"
echo " -- PERCY_TARGET_BRANCH='$PERCY_TARGET_BRANCH'"