Hi

I read environment variables from file. 

The following works, but there is a code duplication:

(

. ${JENKINS_HOME}/jobs/credentials.sh > /dev/null 2>&1
curl -u $GITHUB_USERNAME:$GITHUB_PASSWORD 
https://raw.githubusercontent.com/cloudify-cosmo/cloudify-premium/master/packages-urls/common_build_env.sh
 -o ./common_build_env.sh
. $PWD/common_build_env.sh

)

Where can I read the file so both of the stages will recognize the variables?


pipeline {
    
agent { label 'web-ui-04888827' }


stage('Pack') {
    steps {
        dir('cloudify-stage') {
            sh 'sudo npm run zip'
        }
        sh '''. ${JENKINS_HOME}/jobs/credentials.sh > /dev/null 2>&1
              curl -u $GITHUB_USERNAME:$GITHUB_PASSWORD 
https://raw.githubusercontent.com/cloudify-cosmo/cloudify-premium/master/packages-urls/common_build_env.sh
 -o ./common_build_env.sh
              . $PWD/common_build_env.sh
              mv cloudify-stage/stage.tar.gz  
cloudify-stage-$VERSION-$PRERELEASE.tgz'''

    }
}

stage('Upload package to S3') {
    steps {
        sh '''set +x
              . ${JENKINS_HOME}/jobs/credentials.sh > /dev/null 2>&1
              curl -u $GITHUB_USERNAME:$GITHUB_PASSWORD 
https://raw.githubusercontent.com/cloudify-cosmo/cloudify-premium/master/packages-urls/common_build_env.sh
 -o ./common_build_env.sh
              . $PWD/common_build_env.sh
              s3cmd put --access_key=${AWS_ACCESS_KEY_ID_UPLOAD_TEMP} 
--secret_key=${AWS_ACCESS_KEY_UPLOAD_TEMP} --human-readable-sizes --acl-public 
\\
              cloudify-stage-$VERSION-$PRERELEASE.tgz \\
              s3://$AWS_S3_BUCKET/$AWS_S3_PATH/'''
    }
}

}

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d1510f9f-d313-4700-80d0-81f535fac9a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to