QuestionQ82

VerifiedDevSecOps Pipeline-Build and Test Stage

Alex Hales works as a DevSecOps engineer at an IT company that builds software products and web applications for visualizing scientific data. He wants to trigger a Jenkins build job using a Git post-commit script/hook so that his team saves time by automating the commit process.

Before triggering the build job, Alex:

  • Made changes to the code and saved them in the IDE under the Git repository.
  • Added the changes to the master branch using the git add command.
  • Ran the post-commit script to check the build status.
  • Navigated to the Jenkins project and selected the "Trigger build remotely from Build triggers" radio button, so that the build is automatically triggered every time a change is committed to the project.

Alex then went back to the Bash terminal to trigger the build job.

Which of the following commands should Alex use in the Bash terminal to trigger the build job?

Explanation

Git commits are performed using the git commit command (not github commit, which is not a valid Git CLI invocation), and the flag used to attach a commit message inline is -m (short for --message). The -b flag is not a valid option for git commit; it is used with commands like git checkout -b to create a new branch. Running git commit -m "commit from terminal" creates the commit, which fires the configured post-commit hook script, which in turn calls the Jenkins remote trigger URL to start the build job.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!