0
0
Jenkinsdevops~10 mins

Global shared library configuration 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 define a global shared library in Jenkins pipeline.

Jenkins
library '[1]'
Drag options to blanks, or click blank then click option'
Amy-shared-lib
Bpipeline-lib
Cshared-library
Dcommon-lib
Attempts:
3 left
💡 Hint
Common Mistakes
Using a name not configured in Jenkins global libraries.
Forgetting quotes around the library name.
2fill in blank
medium

Complete the code to call a function 'buildApp' from the shared library.

Jenkins
library('my-shared-lib')
buildResult = [1]()
Drag options to blanks, or click blank then click option'
AbuildApp
BrunBuild
CstartBuild
DbuildProject
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function name not defined in the library.
Missing parentheses when calling the function.
3fill in blank
hard

Fix the error in the global library configuration snippet to specify the SCM repository URL.

Jenkins
libraries {
  myLib {
    scm {
      git {
        url = '[1]'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Assh://github.com/example/my-shared-lib.git
Bgit@github.com:example/my-shared-lib.git
Chttp://github.com/example/my-shared-lib
Dhttps://github.com/example/my-shared-lib.git
Attempts:
3 left
💡 Hint
Common Mistakes
Using SSH URL without proper Jenkins credentials.
Omitting the .git suffix.
4fill in blank
hard

Fill both blanks to configure the global shared library with default version and allow override.

Jenkins
libraries {
  myLib {
    defaultVersion = '[1]'
    allowVersionOverride = [2]
  }
}
Drag options to blanks, or click blank then click option'
Amain
Btrue
Cfalse
Dmaster
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'master' when the repo uses 'main'.
Setting allowVersionOverride to false when override is needed.
5fill in blank
hard

Fill all three blanks to define a global shared library with name, SCM URL, and default version.

Jenkins
libraries {
  [1] {
    scm {
      git {
        url = '[2]'
      }
    }
    defaultVersion = '[3]'
  }
}
Drag options to blanks, or click blank then click option'
AutilsLib
Bhttps://github.com/jenkinsci/utils-lib.git
Cdevelop
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing branch names for defaultVersion.
Using incorrect URL format.
Mismatching library name and repo.