1

I'm having sort of a weird problem with my Jenkins pipeline. I've defined a Dockerfile which installs some tools I need for my CI/CD pipeline, such as node, npm, sfdx, and sfpowerkit (a plugin for sfdx). This is the Dockerfile:

FROM node:14.14-alpine

#add usefull tools
RUN apk add --update --no-cache  \
  git \
  findutils \
  bash \
  unzip \
  curl \
  wget \
  nodejs-npm \
  openjdk8-jre \
  openssh-client \
  perl \
  jq

# install Salesforce CLI from npm
RUN npm install sfdx-cli --global
RUN sfdx --version

# install sfpowerkit - https://github.com/Accenture/sfpowerkit
RUN echo y | sfdx plugins:install sfpowerkit
RUN sfdx plugins

My Jenkinsfile is pretty simple as well:

pipeline {
    agent {
        dockerfile true
    }

    stages {
        stage("build") {
            steps {
                echo "build step"
                sh 'node --version'
                sh 'npm --version'
                sh "sfdx --version"
                sh "sfdx plugins --core"
                sh "sfdx plugins"
                sh "sfdx commands"
                sh 'sfdx sfpowerkit --help' <-- this command fails
            }
        }
    }

}

The problem is that even though I install the plugin sfpowerkit and it shows on the job output that it was successfully installed, the plugin is not available inside the build stage.

This is during the Dockerfile image construction:

sfdx plugins command during Dockerfile build

And this is during the build stage on the pipeline:

sfdx plugins command during build stage

I can't find out what the problem is, and why the plugin is not available after constructing the container through the Dockerfile.

Would anyone be kind to help?

Thank you!!


EDIT 4 Sep:

This is the job output: https://justpaste.it/4jnjn

2 Answers 2

0

I have same issue, adding mkdir .local && chmod g+rwx .local before instalation helped me.

RUN mkdir .local && chmod g+rwx .local \
&& echo 'y' | sfdx plugins:install sfpowerkit

or

install it whithin jenkins 'steps'. it might not be very clever or wise but it should work.

6
  • Hi! Thank you for your help! I've tried adding this but it didn't work :( I don't know if this helps, but I've added the output from the job in the question description. Commented Sep 4, 2021 at 16:43
  • I updated the answer: install it whithin jenkins 'steps'. it might not be very clever or wise but it should work. Commented Sep 4, 2021 at 18:33
  • No matter what I try, it does not work. If I try installing within the 'steps', it hangs forever on "Installing plugin sfpowerkit...". I'm not sure anymore how to proceed hahaha. Any more ideas? Commented Sep 16, 2021 at 0:56
  • did you pipe echo 'y' ? so it will installs by itself? Commented Sep 23, 2021 at 13:27
  • @user_pruser what is the meaning of \ in the above command and should this be in a single line? Commented Jan 7, 2022 at 15:51
0

I was able to solve this issue by using the following docker image instead of the Dockerfile:

"dxatscale/sfpowerscripts"

Here is an example:

pipeline {
    agent {
        docker { image 'dxatscale/sfpowerscripts' }
    }

    stages {
        stage("build") {
            steps {
                echo "build step"
                sh 'node --version'
                sh 'npm --version'
                sh "sfdx --version"
                sh "sfdx plugins --core"
                sh "sfdx plugins"
                sh "sfdx commands"
                sh 'sfdx sfpowerkit --help'
            }
        }
    }

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.