6

Using the Jenkinsfile mechanism - see the Salesforce Jenkinsfile Walkthrough - allows one Continuous Integration (CI) definition to automatically build multiple branches and multiple pull requests via multiple scratch orgs. So it fits well with an SFDX/Git setup.

But I can't find a way to get the sh executions in this step:

stage('Add other packages') {
    // Need to block until the installs are done
    sh "sfdx force:package:install --wait 15 --package ${A_PACKAGE_VERSION_ID} --installationkey ${A_PACKAGE_PASSWORD}"
    sh "sfdx force:package:install --wait 15 --package ${B_PACKAGE_VERSION_ID} --installationkey ${B_PACKAGE_PASSWORD}"
}

to block so that the packages are installed before following tests that depend on those packages run.

If you have this blocking working, please share.

(Note that the Jenkins file adds another layer that seems to stop this salesforce DX installing managed package and status response in an automated environment from being sufficient.)

PS

Thought this might work:

stage('Add other packages') {
    echo "Installing A"
    timeout(900) {
        waitUntil {
            sh "sfdx force:package:install --package ${A_PACKAGE_VERSION_ID} --installationkey ${A_PACKAGE_PASSWORD} --wait 15"
        }
    }
    echo "A installed"

based on Make Jenkins pipeline wait until server is up but I get silent failure immediately after the first echo.

PPS

Both these managed packages include "Remote Site Settings" that normally require a manual confirmation.

2
  • Is the observed behavior that the subshell returns immediately and SFDX spins in the background? (Just asking, I'm not particularly familiar with Jenkins).
    – David Reed
    Dec 5, 2018 at 16:07
  • 1
    @DavidReed Yes, I assume the install continues. But a colleague has just pointed out that adding --noprompt looks like it fixes the problem; without that the sfdx force:package:install is probably waiting for user input as we have remote site definitions in our package and that is blocking the waiting somehow. I've asked him to post an answer here.
    – Keith C
    Dec 5, 2018 at 16:16

1 Answer 1

6

Some installations prompt you for permissions/confirmations.

Check the build failure log and see if there's some pending prompting during your Add other packages stage.

If that's the case, add the --noprompt option to the sfdx force:package:install command.

Explanation

If sfdx prompts the user for confirmations, my guess is that since there's no console attached it just aborts the process.

1
  • Thanks Francesco. Looks like this is the solution. (I think I was getting a return status of zero when I checked though.)
    – Keith C
    Dec 5, 2018 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .