Bird
Raised Fist0
Jenkinsdevops~20 mins

Jenkins to GitHub Actions path - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Jenkins to GitHub Actions Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Key difference in pipeline triggers between Jenkins and GitHub Actions

Which statement best describes how Jenkins and GitHub Actions trigger pipelines?

AJenkins pipelines trigger only manually, GitHub Actions triggers only on schedule.
BJenkins and GitHub Actions both require external cron jobs to trigger pipelines.
CJenkins triggers pipelines only on push events, GitHub Actions triggers only on pull requests.
DJenkins uses webhooks configured in GitHub, while GitHub Actions triggers are defined inside YAML files in the repository.
Attempts:
2 left
💡 Hint

Think about where the trigger configuration lives in each tool.

💻 Command Output
intermediate
1:30remaining
Output of GitHub Actions workflow run status command

What is the output of this GitHub CLI command after a successful workflow run?

Jenkins
gh run view 12345 --json status --jq .status
A"success"
B"completed"
C"passed"
D"done"
Attempts:
2 left
💡 Hint

Check the GitHub CLI documentation for the status field values.

❓ Configuration
advanced
2:30remaining
Correct GitHub Actions YAML syntax for a build job

Which YAML snippet correctly defines a GitHub Actions job that runs on Ubuntu latest and executes a build script?

A
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - script: ./build.sh
B
jobs:
  build:
    runs_on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: ./build.sh
C
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: ./build.sh
D
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - checkout: actions/checkout@v3
      - run: ./build.sh
Attempts:
2 left
💡 Hint

Look carefully at the keys and syntax for steps in GitHub Actions.

❓ Troubleshoot
advanced
2:00remaining
Reason for GitHub Actions workflow not triggering on push

A GitHub Actions workflow does not start when pushing to the main branch. The workflow YAML has:

on:
  push:
    branches:
      - master

What is the most likely cause?

AThe branch name in the YAML is 'master' but the repository uses 'main'.
BGitHub Actions workflows cannot trigger on push events.
CThe workflow file must be named 'main.yml' to trigger on main branch.
DPush events require a personal access token to trigger workflows.
Attempts:
2 left
💡 Hint

Check the branch names carefully.

🔀 Workflow
expert
3:00remaining
Order of steps to migrate Jenkins pipeline to GitHub Actions

Arrange the steps in the correct order to migrate a Jenkins pipeline to GitHub Actions.

A1,2,3,4
B2,1,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint

Think about logical migration steps from analysis to cleanup.

Practice

(1/5)
1. What is the main difference between Jenkins and GitHub Actions in terms of where the automation configuration is stored?
easy
A. Both Jenkins and GitHub Actions store workflows only on external servers.
B. GitHub Actions stores workflow files inside the repository, Jenkins uses an external server.
C. Jenkins stores workflows inside the repository, GitHub Actions uses an external server.
D. Both Jenkins and GitHub Actions store workflows only inside the repository.

Solution

  1. Step 1: Understand Jenkins workflow storage

    Jenkins typically stores job configurations on its own server, separate from the code repository.
  2. Step 2: Understand GitHub Actions workflow storage

    GitHub Actions stores workflow YAML files directly inside the code repository under the .github/workflows directory.
  3. Final Answer:

    GitHub Actions stores workflow files inside the repository, Jenkins uses an external server. -> Option B
  4. Quick Check:

    Workflow location = repository for GitHub Actions [OK]
Hint: Remember: GitHub Actions config lives with your code [OK]
Common Mistakes:
  • Thinking Jenkins stores configs in the repo
  • Assuming GitHub Actions uses external servers only
  • Confusing storage locations for both tools
2. Which of the following is the correct syntax to trigger a GitHub Actions workflow on a push to the main branch?
easy
A. on: push: branches: [main]
B. trigger: push main
C. event: push branch main
D. when: push to main

Solution

  1. Step 1: Recall GitHub Actions trigger syntax

    The correct YAML syntax uses 'on:' followed by the event type and branches list.
  2. Step 2: Match syntax to options

    on: push: branches: [main] matches the correct YAML format: 'on: push: branches: [main]'. Others are invalid YAML or incorrect keywords.
  3. Final Answer:

    on: push: branches: [main] -> Option A
  4. Quick Check:

    Trigger syntax = 'on:' keyword [OK]
Hint: GitHub Actions triggers start with 'on:' in YAML [OK]
Common Mistakes:
  • Using 'trigger' instead of 'on' keyword
  • Incorrect YAML indentation or keywords
  • Confusing event names and branch filters
3. Given this GitHub Actions workflow snippet, what will happen when a pull request is opened?
on:
  pull_request:
    branches:
      - main
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Run tests
        run: echo "Tests running..."
medium
A. The workflow runs only when a pull request targets the main branch.
B. The workflow runs on any pull request regardless of target branch.
C. The workflow runs only on push events, not pull requests.
D. The workflow will fail due to syntax errors.

Solution

  1. Step 1: Analyze the trigger section

    The workflow triggers on pull_request events targeting the 'main' branch only.
  2. Step 2: Understand job execution

    When a pull request is opened against 'main', the job runs the steps: checkout and echo test message.
  3. Final Answer:

    The workflow runs only when a pull request targets the main branch. -> Option A
  4. Quick Check:

    Trigger filters = pull_request on main branch [OK]
Hint: Check 'on:' and branch filters to predict workflow triggers [OK]
Common Mistakes:
  • Assuming it runs on all pull requests
  • Confusing push and pull_request triggers
  • Thinking syntax is invalid when it is correct
4. You migrated a Jenkins pipeline to GitHub Actions but the workflow does not run on push events. Which is the most likely cause?
medium
A. The workflow file is named with a .json extension instead of .yml.
B. The Jenkinsfile syntax was copied directly into the GitHub Actions YAML.
C. The repository is private and GitHub Actions only works on public repos.
D. The workflow YAML file is not placed under the .github/workflows directory.

Solution

  1. Step 1: Check workflow file location

    GitHub Actions requires workflow files to be inside the .github/workflows folder to detect and run them.
  2. Step 2: Evaluate other options

    Copying Jenkinsfile syntax won't run but does not prevent detection; GitHub Actions works on private repos; file extension must be .yml or .yaml, but location is primary cause.
  3. Final Answer:

    The workflow YAML file is not placed under the .github/workflows directory. -> Option D
  4. Quick Check:

    Workflow location = .github/workflows folder [OK]
Hint: Put workflow files in .github/workflows folder [OK]
Common Mistakes:
  • Ignoring file location importance
  • Assuming Jenkinsfile syntax works in GitHub Actions
  • Thinking GitHub Actions only runs on public repos
5. You want to convert a Jenkins pipeline that runs tests on multiple operating systems into a GitHub Actions workflow. Which approach correctly replicates this behavior?
hard
A. Create separate workflows for each OS and trigger them manually.
B. Use a single job with a shell script that switches OS environments inside the runner.
C. Use a matrix strategy in GitHub Actions to run jobs on ubuntu-latest, windows-latest, and macos-latest runners.
D. GitHub Actions does not support multiple OS testing; use Jenkins instead.

Solution

  1. Step 1: Understand Jenkins multi-OS testing

    Jenkins pipelines can run parallel jobs on different OS agents to test across environments.
  2. Step 2: Use GitHub Actions matrix strategy

    GitHub Actions supports a matrix strategy to run the same job on multiple OS runners like ubuntu-latest, windows-latest, and macos-latest automatically.
  3. Final Answer:

    Use a matrix strategy in GitHub Actions to run jobs on ubuntu-latest, windows-latest, and macos-latest runners. -> Option C
  4. Quick Check:

    Matrix strategy = multi-OS testing [OK]
Hint: Use matrix to test multiple OS in one workflow [OK]
Common Mistakes:
  • Trying to switch OS inside one runner
  • Creating many manual workflows instead of matrix
  • Believing GitHub Actions lacks multi-OS support
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard