0
0
Jenkinsdevops~10 mins

Why artifact management matters in Jenkins - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a Jenkins pipeline stage that archives build artifacts.

Jenkins
stage('Archive Artifacts') {
    steps {
        [1] 'build/output/*.jar'
    }
}
Drag options to blanks, or click blank then click option'
Ash
BarchiveArtifacts
Ccheckout
Decho
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'sh' instead of 'archiveArtifacts' to save files.
2fill in blank
medium

Complete the code to upload an artifact to a Nexus repository using a shell command in Jenkins.

Jenkins
stage('Upload Artifact') {
    steps {
        sh 'curl -v -u user:pass -X POST [1]'
    }
}
Drag options to blanks, or click blank then click option'
A"http://nexus.example.com/repository/maven-snapshots/" -F 'file=app.jar'
B"http://nexus.example.com/repository/maven-releases/" -d 'file=app.jar'
C"http://nexus.example.com/repository/maven-releases/" -F 'file=@build/output/app.jar'
D"http://nexus.example.com/repository/maven-releases/" -F 'file=app.jar'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-d' instead of '-F' to upload files.
3fill in blank
hard

Fix the error in the Jenkins pipeline snippet that tries to download an artifact but uses the wrong step.

Jenkins
stage('Download Artifact') {
    steps {
        [1] 'curl -O http://nexus.example.com/repository/maven-releases/app.jar'
    }
}
Drag options to blanks, or click blank then click option'
Ash
BdownloadArtifacts
CarchiveArtifacts
Dcheckout
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'archiveArtifacts' to download files.
4fill in blank
hard

Fill both blanks to create a Jenkins pipeline snippet that saves and then cleans up artifacts.

Jenkins
stage('Save and Clean') {
    steps {
        [1] 'dist/*.zip'
        [2]()
    }
}
Drag options to blanks, or click blank then click option'
AarchiveArtifacts
Bsh
CdeleteDir
Dcheckout
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'sh' to delete directories instead of 'deleteDir'.
5fill in blank
hard

Fill all three blanks to define a Jenkins pipeline that builds, archives, and uploads an artifact.

Jenkins
pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                [1] 'mvn clean package'
            }
        }
        stage('Archive') {
            steps {
                [2] 'target/*.jar'
            }
        }
        stage('Upload') {
            steps {
                [3] 'curl -v -u user:pass -X POST "http://nexus.example.com/repository/maven-releases/" -F "file=@target/app.jar"'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Ash
BarchiveArtifacts
Dcheckout
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'checkout' instead of 'sh' for build or upload steps.