0
0
Jenkinsdevops~10 mins

External artifact repositories (Nexus, Artifactory) in Jenkins - Interactive Code Practice

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

Complete the Jenkins pipeline code to upload an artifact to Nexus.

Jenkins
sh 'curl -v -u admin:admin123 -X POST "http://nexus.example.com/repository/maven-releases/" -F "r=releases" -F "hasPom=false" -F "e=jar" -F "file=[1]"'
Drag options to blanks, or click blank then click option'
Apom.xml
Bsrc/main/java
CREADME.md
Dtarget/my-app.jar
Attempts:
3 left
💡 Hint
Common Mistakes
Using source code folder instead of the built artifact.
Uploading the pom.xml instead of the jar file.
2fill in blank
medium

Complete the Jenkins pipeline snippet to download an artifact from Artifactory using curl.

Jenkins
sh 'curl -u user:password -O http://artifactory.example.com/artifactory/libs-release-local/[1]'
Drag options to blanks, or click blank then click option'
Abuild.gradle
Bsrc/main/resources/config.yaml
Ccom/example/my-app/1.0/my-app-1.0.jar
Ddocs/manual.pdf
Attempts:
3 left
💡 Hint
Common Mistakes
Using source files or documentation instead of the artifact jar.
Incorrect artifact path format.
3fill in blank
hard

Fix the error in this Jenkins pipeline step to publish to Nexus by completing the missing option.

Jenkins
sh 'mvn deploy:deploy-file -Durl=http://nexus.example.com/repository/maven-releases/ -DrepositoryId=[1] -Dfile=target/app.jar -DgroupId=com.example -DartifactId=app -Dversion=1.0 -Dpackaging=jar'
Drag options to blanks, or click blank then click option'
Anexus
Breleases
Ccentral
Dsnapshots
Attempts:
3 left
💡 Hint
Common Mistakes
Using repository names like 'central' which is Maven Central, not Nexus.
Using 'releases' or 'snapshots' which are repository names, not repository IDs.
4fill in blank
hard

Fill both blanks to configure Jenkins to use Artifactory plugin for uploading artifacts.

Jenkins
def server = Artifactory.server('[1]')
server.upload spec: '''{
  "files": [
    {"pattern": "build/libs/*.jar", "target": "[2]"}
  ]
}'''
Drag options to blanks, or click blank then click option'
Aartifactory-server
Blibs-release-local
Clibs-snapshot-local
Ddocker-local
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing server ID with repository name.
Using snapshot repository for release artifacts.
5fill in blank
hard

Fill all three blanks to define a Jenkins pipeline step that downloads a specific artifact from Nexus using curl.

Jenkins
sh 'curl -u [1]:[2] -O http://nexus.example.com/repository/[3]/com/example/app/1.0/app-1.0.jar'
Drag options to blanks, or click blank then click option'
Aadmin
Badmin123
Cmaven-releases
Dmaven-snapshots
Attempts:
3 left
💡 Hint
Common Mistakes
Using snapshot repository for release artifact download.
Incorrect or missing credentials causing authentication failure.