Update Jenkins scripts
This commit is contained in:
parent
7f1a7dfa1e
commit
c84a90c4a5
@ -2,10 +2,17 @@ import jobs.generation.Utilities;
|
|||||||
import jobs.generation.InternalUtilities;
|
import jobs.generation.InternalUtilities;
|
||||||
|
|
||||||
def project = GithubProject
|
def project = GithubProject
|
||||||
def branch = GithubBranchName
|
def projectName = "pxt-calliope"
|
||||||
|
|
||||||
[true, false].each { isPR ->
|
[true, false].each { isPR ->
|
||||||
def newJobName = InternalUtilities.getFullJobName(project, "Default", isPR)
|
def newJobName = projectName
|
||||||
|
|
||||||
|
if (isPR) {
|
||||||
|
newJobName += "_PR"
|
||||||
|
} else {
|
||||||
|
newJobName += "_Push"
|
||||||
|
}
|
||||||
|
|
||||||
def newJob = job(newJobName) {
|
def newJob = job(newJobName) {
|
||||||
steps {
|
steps {
|
||||||
shell("chmod +x ./jenkins.sh")
|
shell("chmod +x ./jenkins.sh")
|
||||||
@ -15,14 +22,14 @@ def branch = GithubBranchName
|
|||||||
if (!isPR) {
|
if (!isPR) {
|
||||||
wrappers {
|
wrappers {
|
||||||
credentialsBinding {
|
credentialsBinding {
|
||||||
string('PXT_ACCESS_TOKEN', 'pxt_access_token')
|
string("PXT_ACCESS_TOKEN", "pxt_access_token")
|
||||||
string('PXT_RELEASE_REPO', 'pxt_release_repo_calliope')
|
string("PXT_RELEASE_REPO", "pxt_release_repo_calliope")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utilities.setMachineAffinity(newJob, 'Ubuntu', '20161020')
|
Utilities.setMachineAffinity(newJob, "Ubuntu", "20161020")
|
||||||
InternalUtilities.standardJobSetup(newJob, project, isPR, "*/*")
|
InternalUtilities.standardJobSetup(newJob, project, isPR, "*/*")
|
||||||
|
|
||||||
if (isPR) {
|
if (isPR) {
|
||||||
|
@ -13,6 +13,7 @@ echo isPR: $1
|
|||||||
|
|
||||||
originRegex="^origin/.*"
|
originRegex="^origin/.*"
|
||||||
branchRegex="^origin/\K.*(?=$)"
|
branchRegex="^origin/\K.*(?=$)"
|
||||||
|
releaseBranchRegex = "^(master|v\d+)$"
|
||||||
|
|
||||||
if [[ "$GIT_BRANCH" =~ $originRegex ]]; then
|
if [[ "$GIT_BRANCH" =~ $originRegex ]]; then
|
||||||
branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex)
|
branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex)
|
||||||
@ -27,9 +28,9 @@ if [ "$1" == "false" ]; then
|
|||||||
echo Setting TRAVIS_PULL_REQUEST to false
|
echo Setting TRAVIS_PULL_REQUEST to false
|
||||||
export TRAVIS_PULL_REQUEST=false
|
export TRAVIS_PULL_REQUEST=false
|
||||||
|
|
||||||
if [ $TRAVIS_BRANCH == "master" ]; then
|
if [[ "$TRAVIS_BRANCH" =~ $releaseBranchRegex ]]; then
|
||||||
if [[ -z $PXT_RELEASE_REPO ]]; then
|
if [[ -z $PXT_RELEASE_REPO ]]; then
|
||||||
echo Cannot find release repo; skipping tag checks
|
echo Cannot find release repo\; skipping tag checks
|
||||||
else
|
else
|
||||||
gitTag=$(git describe --tags --exact-match 2> /dev/null)
|
gitTag=$(git describe --tags --exact-match 2> /dev/null)
|
||||||
builtTag=$(git ls-remote --tags $PXT_RELEASE_REPO | grep -o "refs/tags/$gitTag$")
|
builtTag=$(git ls-remote --tags $PXT_RELEASE_REPO | grep -o "refs/tags/$gitTag$")
|
||||||
@ -38,7 +39,7 @@ if [ "$1" == "false" ]; then
|
|||||||
echo Built tag: $builtTag
|
echo Built tag: $builtTag
|
||||||
|
|
||||||
if [[ ! -z $gitTag && -z $builtTag ]]; then
|
if [[ ! -z $gitTag && -z $builtTag ]]; then
|
||||||
echo Built tag not found; building tag
|
echo Built tag not found\; building tag
|
||||||
echo Setting TRAVIS_BRANCH to $gitTag
|
echo Setting TRAVIS_BRANCH to $gitTag
|
||||||
export TRAVIS_BRANCH=$gitTag
|
export TRAVIS_BRANCH=$gitTag
|
||||||
echo Setting TRAVIS_TAG to $gitTag
|
echo Setting TRAVIS_TAG to $gitTag
|
||||||
|
Loading…
Reference in New Issue
Block a user