Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
create docker image #3
  • Loading branch information
metas-ts committed May 5, 2017
1 parent 8b7b748 commit 5139c84
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 69 deletions.
69 changes: 1 addition & 68 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -133,59 +133,6 @@ def deleteRepo(String repoId)
}
}

/**
* This method will be used further down to call additional jobs such as metasfresh-procurement and metasfresh-webui
*/
def invokeDownStreamJobs(String jobFolderName, String buildId, String upstreamBranch, boolean wait)
{
echo "Invoking downstream job from folder=${jobFolderName} with preferred branch=${upstreamBranch}"

// if this is not the master branch but a feature branch, we need to find out if the "BRANCH_NAME" job exists or not
//
// Here i'm not checking if the build job exists but if the respective branch on github exists. If the branch is there, then I assume that the multibranch plugin also created the job
def exitCode;
node('linux')
{
// We run this within a node to avoid the error saying:
// Required context class hudson.FilePath is missing
// Perhaps you forgot to surround the code with a step that provides this, such as: node
// ...
// org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing

exitCode = sh returnStatus: true, script: "git ls-remote --exit-code https://github.com/metasfresh/${jobFolderName} ${upstreamBranch}"
}

if(exitCode == 0)
{
echo "Branch ${upstreamBranch} also exists in ${jobFolderName}"
jobName = jobFolderName + "/" + upstreamBranch
}
else
{
echo "Branch ${upstreamBranch} does not exist in ${jobFolderName}; falling back to master"
jobName = jobFolderName + "/master"
}

// I also tried
// https://jenkins.metasfresh.com/job/metasfresh-multibranch/api/xml?tree=jobs[name]
// which worked from chrome, also for metas-dev.
// It worked from the shell using curl (with [ and ] escaped) for user metas-ts and an access token,
// but did not work from the shell with curl and user metas-dev with "metas-dev is missing the Overall/Read permission"
// the curl string was sh "curl -XGET 'https://jenkins.metasfresh.com/job/metasfresh-multibranch/api/xml?tree=jobs%5Bname%5D' --user metas-dev:access-token

// and I also tried inspecting the list returned by
// Jenkins.instance.getAllItems()
// but there I got a scurity exception and am not sure if an how I can have a SCM maintained script that is approved by an admin

build job: jobName,
parameters: [
string(name: 'MF_UPSTREAM_BRANCH', value: upstreamBranch),
string(name: 'MF_BUILD_ID', value: buildId),
booleanParam(name: 'MF_TRIGGER_DOWNSTREAM_BUILDS', value: false), // the job shall just run but not trigger further builds because we are doing all the orchestration
booleanParam(name: 'MF_SKIP_TO_DIST', value: true) // this param is only recognised by metasfresh
], wait: wait
}

//
// setup: we'll need the following variables in different stages, that's we we create them here
//
Expand Down Expand Up @@ -314,21 +261,7 @@ node('agent && linux && dejenkinsnode001') // shall only run on a jenkins agent
}
}
}
/*
if(params.MF_TRIGGER_DOWNSTREAM_BUILDS)
{
stage('Invoke downstream job')
{
invokeDownStreamJobs('metasfresh', MF_BUILD_ID, MF_UPSTREAM_BRANCH, false); // wait=false
}
}
else
{
echo "params.MF_TRIGGER_DOWNSTREAM_BUILDS=${params.MF_TRIGGER_DOWNSTREAM_BUILDS}, so we do not trigger any downstream builds"
}
*/
// clean up the work space, including the local maven repositories that the withMaven steps created
// don't clean up the work space..we do it when we check out next time
// step([$class: 'WsCleanup', cleanWhenFailure: false])
step([$class: 'WsCleanup', cleanWhenFailure: false])
} // node
} // timestamps
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<spring-boot.version>1.5.3.RELEASE</spring-boot.version>
<spring-boot-admin.version>1.5.0</spring-boot-admin.version>
<start-class>de.metas.admin.SpringBootAdminApplication</start-class>
<docker.image.prefix>metasfresh</docker.image.prefix>
</properties>

<dependencyManagement>
Expand Down

0 comments on commit 5139c84

Please sign in to comment.