0
0
Jenkinsdevops~10 mins

Copying artifacts between jobs in Jenkins - Interactive Code Practice

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

Complete the code to archive artifacts in a Jenkins job.

Jenkins
steps {
  archiveArtifacts artifacts: '[1]'
}
Drag options to blanks, or click blank then click option'
A**/*.jar
Bbuild.log
Csrc/*.java
DREADME.md
Attempts:
3 left
💡 Hint
Common Mistakes
Using a specific file name instead of a pattern.
Not including subdirectories with **.
Using a file type that is not an artifact.
2fill in blank
medium

Complete the code to copy artifacts from another Jenkins job.

Jenkins
steps {
  copyArtifacts(projectName: '[1]')
}
Drag options to blanks, or click blank then click option'
ATestJob
Bbuild.log
Csrc/*.java
DREADME.md
Attempts:
3 left
💡 Hint
Common Mistakes
Using a file name instead of a job name.
Leaving the parameter empty.
Confusing artifact patterns with job names.
3fill in blank
hard

Fix the error in the code to copy artifacts from a specific build number.

Jenkins
steps {
  copyArtifacts(projectName: 'BuildJob', selector: [1])
}
Drag options to blanks, or click blank then click option'
AbuildNumber(5)
Bspecific('5')
Cbuild('5')
DlastSuccessful()
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect selector syntax.
Passing a number directly instead of a selector object.
Using undefined selector methods.
4fill in blank
hard

Fill both blanks to copy artifacts from a job named 'DeployJob' and only include files matching '*.war'.

Jenkins
steps {
  copyArtifacts(projectName: '[1]', filter: '[2]')
}
Drag options to blanks, or click blank then click option'
ADeployJob
B*.war
C*.jar
DBuildJob
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing job names and file patterns.
Using wrong file extensions.
Leaving blanks empty.
5fill in blank
hard

Fill all three blanks to archive all JAR files, then copy artifacts from 'BuildJob' filtering '*.jar' files.

Jenkins
pipeline {
  stages {
    stage('Archive') {
      steps {
        archiveArtifacts artifacts: '[1]'
      }
    }
    stage('Copy') {
      steps {
        copyArtifacts(projectName: '[2]', filter: '[3]')
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A**/*.jar
BBuildJob
C*.jar
DDeployJob
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent file patterns.
Mixing job names.
Forgetting to specify filter when copying.