You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.
When I look at for example this Maven Jenkinsfile, I see way too much Pipeline script. There is no reason for any stage to have more than one sh step unless some other Pipeline step (not counting dir) intervenes. For example,
sh "git config --global credential.helper store"
sh "jx step validate --min-jx-version 1.1.73"
sh "jx step git credentials"// so we can retrieve the version in later steps
sh "echo \$(jx-release-version) > VERSION"
sh "mvn versions:set -DnewVersion=\$(cat VERSION)"
dir ('./charts/vertx-demo') {
sh "make tag"
}
sh 'mvn clean deploy'
sh 'export VERSION=`cat VERSION` && skaffold build -f skaffold.yaml'
sh "jx step post build --image \$DOCKER_REGISTRY/$ORG/$APP_NAME:\$(cat VERSION)"
would better be collapsed to
sh 'sh build-release.sh'
where that shell script is added to the repo:
#!/bin/sh -xe
git config --global credential.helper store
jx step validate --min-jx-version 1.1.73
jx step git credentials
export VERSION=$(jx-release-version)
mvn versions:set -DnewVersion=$VERSION
make -C charts/vertx-demo tag
mvn clean deploy
skaffold build -f skaffold.yaml
jx step post build --image $DOCKER_REGISTRY/$ORG/$APP_NAME:$VERSION
which is more readable and maintainable. Any per-stageenvironments can also be inlined into the script; for example:
When I look at for example this Maven
Jenkinsfile
, I see way too much Pipeline script. There is no reason for anystage
to have more than onesh
step unless some other Pipeline step (not countingdir
) intervenes. For example,would better be collapsed to
sh 'sh build-release.sh'
where that shell script is added to the repo:
which is more readable and maintainable. Any per-
stage
environment
s can also be inlined into the script; for example:PREVIEW_NAMESPACE=$(echo APP_NAME-$BRANCH_NAME | tr '[A-Z]' '[a-z]')
Only the top-level
environment
blocks are actually useful, for defining variables used in multiple stages and thus scripts.Would be happy to file a PR, though I am not sure how you go about testing changes to draft packs.
The text was updated successfully, but these errors were encountered: