stages {
stage("...") {
script {
for (String repoName: repoList) {
sshagent (credentials: ['e276113e-0ec9-4eaa-88f9-a7db5c9635b6']) {
sh """
git clone -b master git@****.com:****/repoName.git cd repoName
....
"""
}
}
}
}
}
groovy.lang.MissingPropertyException: No such property: moduleName for class: WorkflowScript
def repoList = ReposToUpdate.tokenize(",");
def moduleList = npmDependencies.tokenize(",");
pipeline {
agent {
label 'cert_mgmt'
}
stages {
stage ("Update package.json") {
steps {
script {
for (String repoName : repoList) {
sshagent (credentials: ['credentials-ID']) {
sh """
git clone -b master git@****.com:****/${repoName}.git
cd ${repoName}
stat -t . > folderStat1.txt
for (String moduleName : moduleList) {
ncu -u -f "${moduleName}"
}
stat -t . > folderStat2.txt
"""
def folderStat1 = readFile('folderStat1.txt').trim()
def folderStat2 = readFile('folderStat2.txt').trim()
if (folderStat1 == folderStat2) {
slackSend (
color: '#199515',
message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER> ${repoName}: Common code dependencies match the latest package versions."
)
}
else {
sh """
cd ${repoName}
git config --global user.name "****"
git config --global user.email ****
git commit -am 'Bump common packages version number [ci skip]'
git push origin master
cd ..
rm -rf ${repoName}
"""
slackSend (
color: '#199515',
message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER> ${repoName}: Common code dependencies successfully updated to the latest package versions."
)
}
}
}
}
}
}
}
post {
failure {
slackSend (
color: '#F01717',
message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, Update failed. Review the build logs."
)
}
}
}
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f5ba050e-2d42-47d4-8183-89e43edc6fec%40googlegroups.com.
java.lang.NullPointerException: Cannot get property '$repoName' on null object
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/54962dc1-e80e-4ce3-8583-652a1fd714fe%40googlegroups.com.
[Commons Updater] Running shell script + git clone -b master git@****.com:****/.git Cloning into 'security-services'... ERROR: Repository not found. fatal: Could not read from remote repository.
for (int i = 0; i < repoList.size(); i++) {
def repoName = repoList[i]
sshagent (credentials: ['credential-id']) {
sh '''
git clone -b master git@****.com:****/${repoName}.git
cd ${repoName}
...
def repoList = ReposToUpdate.tokenize(",");
echo repoList[0]
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
sh '''
sh """
Did you get this working?
Your problem was caused by mixing Groovy code within a shell command block.
sh
"""
git clone -b master
git@****.com:****/${repoName}.git
cd ${repoName}
stat -t . > folderStat1.txt
for (String moduleName : moduleList) {
ncu -u -f "${moduleName}"
}
stat -t . > folderStat2.txt
"""
should probably be:
sh
"""
git clone -b master
git@****.com:****/${repoName}.git
cd ${repoName}
stat -t . > folderStat1.txt
stat -t . > folderStat2.txt
"""
for (String moduleName : moduleList) {
sh """
ncu -u -f "${moduleName}"
"""
}
Good luck!
Joachim
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f5ba050e-2d42-47d4-8183-89e43edc6fec%40googlegroups.com.