Uploaded image for project: 'Jenkins Artifactory Plug-in'
  1. Jenkins Artifactory Plug-in
  2. HAP-1228

rtNpm install & publish in docker agent

    XMLWordPrintable

    Details

    • Type: Feature Request
    • Status: Resolved
    • Priority: 4 - Normal
    • Resolution: Done
    • Affects Version/s: 3.3.2
    • Fix Version/s: 3.5.0
    • Component/s: Common
    • Labels:

      Description

      Trying to do this in a Pod Template...

      @Library('default') _

      import pe.interbank.devops.PodTemplates

      slaveTemplates = new PodTemplates()

      slaveTemplates.nodeTemplate() {
      node(POD_LABEL) {
      container('node') {
      try {
      def server = Artifactory.server server: 'Saas'
      def build = Artifactory.newNpmBuild()
      build.deployer repo: 'warhol-release', server: server
      build.resolver repo: 'warhol-libs', server: server
      def buildInfo = Artifactory.newBuildInfo()
      buildInfo.env.capture = true

      stage('Clone')

      { git url: 'git@bitbucket.org:ibkteam/bpi-web-app-front.git', branch: 'devops', credentialsId: 'bitbucket' }

      dir('spa-warhol') {
      stage('Build')

      { build.install args: '--unsafe-perm', buildInfo: buildInfo }

      stage('Code Quality') {
      withSonarQubeEnv() {
      scannerHome = tool name: 'default', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
      sh "${scannerHome}/sonar-scanner-4.0.0.1744-linux/bin/sonar-scanner -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_AUTH_TOKEN"
      }
      }

      stage('Quality Gate') {
      timeout(time: 60, unit: 'SECONDS') {
      qg = waitForQualityGate()
      if (qg.status != 'OK') {
      throw new RuntimeException("Pipeline aborted due to quality gate coverage failure: ${qg.status}")
      }
      }
      }

      stage('Upload')

      { build.publish buildInfo: buildInfo }

      }

      stage('Publish')

      { server.publishBuildInfo buildInfo cleanWs() }

      } catch (e)

      { throw e }

      }
      }
      }

      But getting...

      Cannot run program "npm" (in directory "/home/jenkins/agent/workspace/UAT/Test/spa-warhol"): error=2, No such file or directory

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              yahavi Yahav Itzhak
              Reporter:
              echavez Eliezer Efraín Chávez
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: