nerdexam
GitHub

GITHUB-ACTIONS · Question #74

As a DevOps engineer, you are developing a container action. You need to execute a cleanup script after completing the main script execution. Which code block should be used to define the cleanup…

The correct answer is A. runs: using: 'docker' image: 'Dockerfile' entrypoint: 'main.sh' post: 'cleanup.sh'. The correct syntax for specifying a cleanup script to be run after the main entry point is executed in a Docker-based GitHub Action is to use the post key. This ensures that cleanup.sh runs after the main script (main.sh) has completed.

Author and maintain actions

Question

As a DevOps engineer, you are developing a container action. You need to execute a cleanup script after completing the main script execution. Which code block should be used to define the cleanup script? A. B. C. D.

Exhibit

GITHUB-ACTIONS question #74 exhibit

Options

  • Aruns: using: 'docker' image: 'Dockerfile' entrypoint: 'main.sh' post: 'cleanup.sh'
  • Bruns: using: 'docker' image: 'Dockerfile' entrypoint: 'main.sh' post-if: 'cleanup.sh'
  • Cruns: using: 'docker' image: 'Dockerfile' entrypoint: 'main.sh' after: 'cleanup.sh'
  • Druns: using: 'docker' image: 'Dockerfile' entrypoint: 'main.sh' post-entrypoint: 'cleanup.sh'

How the community answered

(36 responses)
  • A
    69% (25)
  • B
    8% (3)
  • C
    17% (6)
  • D
    6% (2)

Explanation

The correct syntax for specifying a cleanup script to be run after the main entry point is executed in a Docker-based GitHub Action is to use the post key. This ensures that cleanup.sh runs after the main script (main.sh) has completed.

Topics

#container actions#post entrypoint#cleanup script#action.yml syntax

Community Discussion

No community discussion yet for this question.

Full GITHUB-ACTIONS Practice