1

I am trying to scan a build with Jfrog xray, but the scan does not finish. Instead it remains idling. My pipeline stages are configured like so

stage('Publish'){
            steps {
                rtPublishBuildInfo (
                    serverId : 'my-server',
                    buildName : env.JOB_NAME,
                    buildNumber : BUILD_NUMBER
                )
            }
        }

        //Scan Build Artifacts in Xray
        stage('Xray Scan') {
            steps{
                script{
                    xrayConfig = [
                        'buildName'     : env.JOB_NAME,
                        'buildNumber'   : BUILD_NUMBER,
                        'failBuild'     : false
                    ]
                    xrayResults = rtServer.xrayScan xrayConfig
                    echo xrayResults as String
                    sleep 10
                }
            }
        }

The pipeline never finishes scanning though. Instead it remains idling. enter image description here

Is the a good way to debug this process? I'd like to scan builds with xray.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Evan Gertis
  • 1,796
  • 2
  • 25
  • 59

1 Answers1

-1

This solved my problem

pipeline {
    stages {

        stage('Xray Initialization'){
            steps{
                script {
                    rtServer = Artifactory.newServer url: 'server', username: username , password: password
                    buildInfo = Artifactory.newBuildInfo()
                }
            }
        }

        stage('Build') {
            steps {
                script {
                        ***** PERFORM BUILD AND UPLOAD TO ARTIFACTIORY HERE ****
                        buildName: env.JOB_NAME,
                        buildNumber: BUILD_NUMBER
                    )
                }
            }
        }

        stage('Configure Xray build info'){
            steps{
                rtBuildInfo (
                    buildName: "my-build",
                    buildNumber: BUILD_NUMBER,
                    maxBuilds: 1,
                    maxDays: 2,
                    doNotDiscardBuilds: ["3"],
                    deleteBuildArtifacts: true
                )
            }
        }

        stage('Publish to Xray'){
            steps {
                rtPublishBuildInfo (
                    serverId : 'server',
                    buildName : env.JOB_NAME,
                    buildNumber : BUILD_NUMBER
                )
            }
        }

        //Scan Build Artifacts in Xray
        stage('Xray Scan') {
            steps{
                script{
                   xrayScan (
                        serverId :   "server",
                        buildName    : env.JOB_NAME,
                        buildNumber : BUILD_NUMBER,
                        failBuild    : false
                    )
                }
            }
        }
    }
}

You'll need to add the build, upload functionality, and credentials for initializing an instance of an Artifactory Server.

Evan Gertis
  • 1,796
  • 2
  • 25
  • 59