GH-200実際の問題解答PDFには100%カバー率リアル試験問題
GH-200試験問題解答
Microsoft GH-200 認定試験の出題範囲:
| トピック | 出題範囲 |
|---|---|
| トピック 1 |
|
| トピック 2 |
|
| トピック 3 |
|
| トピック 4 |
|
質問 # 55
As a developer, you need to leverage Redis in your workflow. What is the best way to use Redis on a self-hosted Linux runner without affecting future workflow runs?
- A. Add a run step to your workflow, which dynamically installs and configures Redis as part of your job.
- B. Set up Redis on a separate machine and reference that instance from your job.
- C. Specify container: and services: in your job definition to leverage a Redis service container.
- D. Install Redis on the hosted runner image and place it in a runner group. Specify label: in your job to target the runner group.
正解:C
解説:
Creating Redis service containers
You can use service containers to create a Redis client in your workflow. You can create a Redis service for jobs that run in containers or directly on the runner machine.
Configuring the runner job
The example uses the ubuntu-latest GitHub-hosted runner as the Docker host.
The workflow configures a service container with the label redis.
jobs:
# Label of the runner job
runner-job:
# You must use a Linux environment when using service containers or container jobs runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
Reference:
https://docs.github.com/en/actions/tutorials/use-containerized-services/create-redis-service- containers
質問 # 56
As a developer, your Actions workflow often reuses the same outputs or downloaded dependencies from one run to another. To cache dependencies for a job, you are using the GitHub cache action. Which input parameters are required for this action? (Each correct answer presents part of the solution. Choose two.)
- A. restore-keys: the copy action key used with cache parameter to cache the data
- B. path: the file path on the runner to cache or restore
- C. key: the key created when saving a cache and the key used to search for a cache
- D. dependency: the name and version of a package to cache or restore
- E. cache-hit: the copy action key used with restore parameter to restore the data from the cache
- F. ref: the ref name of the branch to access and restore a cache created
正解:B、C
解説:
Input parameters for the cache action
[C] key: Required The key created when saving a cache and the key used to search for a cache.
It can be any combination of variables, context values, static strings, and functions. Keys have a maximum length of 512 characters, and keys longer than the maximum length will cause the action to fail.
[A] path: Required The path(s) on the runner to cache or restore.
Reference:
https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching
質問 # 57
Which workflow commands send information from the runner? (Choose two.)
- A. reading from environment variables
- B. populating variables in a Dockerfile
- C. setting a debug message
- D. setting output parameters
正解:C、D
解説:
Setting a debug message using ::debug:: command sends a message to the logs, helping with troubleshooting and providing insight into the workflow run.
Setting output parameters using ::set-output sends data from a job step to subsequent steps or jobs, which can be used later in the workflow.
質問 # 58
As a developer, what is the safest way to reference an action to prevent modification of the underlying code?
- A. Use a branch name.
- B. Use a commit hash.
- C. Use a patch release tag.
- D. Use a major release tag.
正解:B
解説:
Using a commit hash is the safest method because it references a specific point in time in the repository's history. This ensures that the action is locked to that exact version and will not be affected by any future changes or modifications to the codebase. Even if the action is updated later, your workflow will continue using the specific commit you referenced.
質問 # 59
What menu options in a repository do you need to select in order to use a starter workflow that is provided by your organization?
- A. Workflow > Load workflow
- B. Actions > Load workflow
- C. Workflow > New workflow
- D. Actions > New workflow
正解:D
解説:
To use a starter workflow provided by your organization, you need to go to the Actions tab in the repository and select New workflow. This option allows you to either create a new workflow or select from a list of available workflow templates, including starter workflows provided by your organization.
質問 # 60
As a developer, you need to use GitHub Actions to deploy a microservice that requires runtime access to a secure token. This token is used by a variety of other microservices managed by different teams in different repos. To minimize management overhead and ensure the token is secure, which mechanisms should you use to store and access the token? (Choose two.)
- A. Use a corporate non-GitHub secret store (e.g., HashiCorp Vault) to store the token. During deployment, use GitHub Actions to store the secret in an environment variable that can be accessed at runtime.
- B. Store the token in a configuration file in a private repository. Use GitHub Actions to deploy the configuration file to the runtime environment.
- C. Store the token as a GitHub encrypted secret in the same repo as the code. During deployment, use GitHub Actions to store the secret in an environment variable that can be accessed at runtime.
- D. Store the token as a GitHub encrypted secret in the same repo as the code. Create a reusable custom GitHub Action to access the token by the microservice at runtime.
- E. Store the token as an organizational-level encrypted secret in GitHub. During deployment, use GitHub Actions to store the secret in an environment variable that can be accessed at runtime.
正解:A、E
解説:
Using a corporate secret store like HashiCorp Vault provides a secure, centralized location for sensitive information. GitHub Actions can then retrieve and store the token securely during deployment by setting it as an environment variable, ensuring the token remains secure and accessible at runtime.
Storing the token as an organizational-level encrypted secret in GitHub ensures it is accessible across multiple repositories, minimizing management overhead. GitHub Actions can then use this secret during deployment by setting it as an environment variable, allowing the microservice to access it securely at runtime.
質問 # 61
Which of the following is the proper syntax to specify a custom environment variable named MY_VARIABLE with the value my-value?
- A. environment:
MY_VARIABLE = my-value - B. env:
MY_VARIABLE: my-value - C. environment:
MY_VARIABLE: my-value - D. var:
MY_VARIABLE: my-value - E. var:
MY_VARIABLE = my-value - F. env:
MY_VARIABLE = my-value
正解:B
解説:
To set a custom environment variable for a single workflow, you can define it using the env key in the workflow file.
Example:
env:
DAY_OF_WEEK: Monday
Note: The scope of a custom variable set by this method is limited to the element in which it is defined. You can define variables that are scoped for:
The entire workflow, by using env at the top level of the workflow file.
The contents of a job within a workflow, by using jobs.<job_id>.env.
A specific step within a job, by using jobs.<job_id>.steps[*].env.
Reference:
https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use- variables
質問 # 62
By default, which workflows can use an action stored in internal repository? (Each answer presents a complete solution. Choose two.)
- A. internal repositories owned by the same organization as the enterprise
- B. private repositories owned by an organization of the enterprise
- C. public repositories owned by the same organization as the enterprise
- D. selected public repositories outside of the enterprise
正解:A、B
解説:
Any actions or reusable workflows stored in the internal or private repository can be used in workflows defined in other internal or private repositories owned by the same organization, or by any organization owned by the enterprise.
Reference:
https://docs.github.com/actions/creating-actions/sharing-actions-and-workflows-with-your- enterprise
質問 # 63
Disabling a workflow allows you to stop a workflow from being triggered without having to delete the file from the repo. In which scenarios would temporarily disabling a workflow be most useful?
(Each correct answer presents a complete solution. Choose two.)
- A. A workflow needs to be changed from running on a schedule to a manual trigger.
- B. A workflow is configured to run on self-hosted runners.
- C. A workflow error produces too many, or wrong, requests, impacting external services negatively.
- D. A runner needs to have diagnostic logging enabled.
- E. A workflow sends requests to a service that is down.
正解:C、E
解説:
Temporarily disabling a workflow can be useful in many scenarios. These are a few examples where disabling a workflow might be helpful:
[B] A workflow error that produces too many or wrong requests, impacting external services negatively.
A workflow that is not critical and is consuming too many minutes on your account.
[D] A workflow that sends requests to a service that is down.
Workflows on a forked repository that aren't needed (for example, scheduled workflows).
Reference:
https://docs.github.com/en/actions/how-tos/manage-workflow-runs/disable-and-enable-workflows
質問 # 64
As a DevOps engineer, you need to define a deployment workflow that runs after the build workflow has successfully completed. Without modifying the build workflow, which trigger should you define in the deployment workflow?
- A. workflow_dispatch
- B. repository_dispatch
- C. workflow_exec
- D. workflow_run
正解:D
解説:
A deployment workflow can be started after a build workflow has finished by using the workflow_run event in the deployment workflow's on trigger. You must specify the name of the build workflow you want to trigger on and use an if condition to ensure the deployment workflow only runs if the build workflow successfully completes.
Here's how to set it up:
In your deployment workflow file: (e.g., deploy.yml), define the on: trigger.
Use the workflow_run event: within the on: trigger.
Specify the build workflow: by its name.
Add a conditional if statement: to the workflow to check the conclusion of the workflow_run event, ensuring it equals 'success'.
Reference:
https://docs.github.com/actions/learn-github-actions/events-that-trigger-workflows
質問 # 65
Which default GitHub environment variable indicates the name of the person or app that initiated a workflow?
- A. GITHUB_WORKFLOW_ACTOR
- B. GITHUB_USER
- C. GITHUB_ACTOR
- D. ENV_ACTOR
正解:C
解説:
The GITHUB_ACTOR environment variable indicates the name of the person or app that initiated the workflow. This variable is automatically provided by GitHub in the workflow and can be used to identify the user or application triggering the workflow.
質問 # 66
As a developer, you are using a Docker container action in your workflow. What is required for the action to run successfully?
- A. The action must be published to the GitHub Marketplace.
- B. The job runs-on must specify a Linux machine with Docker installed.
- C. The referenced action must be hosted on Docker Hub.
- D. The job env must be set to a Linux environment.
正解:B
解説:
For a Docker container action to run in a GitHub Actions workflow, the runner must have Docker installed. The runs-on attribute of the job should specify an environment that supports Docker, typically a Linux environment (e.g., ubuntu-latest), since Docker is widely supported and commonly used in Linux-based environments.
質問 # 67
As a developer, you have configured an IP allow list on a GitHub organization. Which effects does the IP allow list have on GitHub Actions? (Each answer presents a complete solution.
Choose two.)
- A. You can use GitHub-hosted larger runners since they can be configured with static IP addresses.
- B. You can use self-hosted runners with known IP addresses.
- C. You must allow GitHub Actions's IP address ranges in order to use marketplace actions.
- D. You can use standard GitHub-hosted runners since their IP addresses are automatically allowed.
正解:A、B
解説:
Using GitHub Actions with an IP allow list. If you use an IP allow list and would also like to use GitHub Actions, you must use self-hosted runners or GitHub-hosted larger runners with static IP address ranges To allow your self-hosted or larger hosted runners to communicate with GitHub, add the IP address or IP address range of your runners to the IP allow list that you have configured for your enterprise.
Reference:
https://docs.github.com/en/enterprise-cloud@latest/organizations/keeping-your-organization- secure/managing-security-settings-for-your-organization/managing-allowed-ip-addresses-for- your-organization
質問 # 68
Which command can you include in your workflow file to set the output parameter for an action?
- A. echo "action_color=purple" >> $GITHUB_OUTPUT
- B. echo "::debug::action_color=purple"
- C. echo "action_color=purple" >> $GITHUB_ENV
- D. echo "::add-mask::$ACTI0N_C0L0R"
正解:A
解説:
Setting an output parameter
Sets a step's output parameter. Note that the step will need an id to be defined to later retrieve the output value. You can set multi-line output values with the same technique used in the Multiline strings section to define multi-line environment variables.
echo "{name}={value}" >> "$GITHUB_OUTPUT"
Example of setting an output parameter
This example demonstrates how to set the SELECTED_COLOR output parameter and later retrieve it:
- name: Set color
id: color-selector
run: echo "SELECTED_COLOR=green" >> "$GITHUB_OUTPUT"
- name: Get color
env:
SELECTED_COLOR: ${{ steps.color-selector.outputs.SELECTED_COLOR }}
run: echo "The selected color is $SELECTED_COLOR"
Reference:
https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands
質問 # 69
As a DevOps engineer, you are developing workflows to build an application. You have a requirement to create the build targeting multiple node versions. Which code block should you use to define the workflow?
- A.

- B.

- C.

- D.

正解:A
解説:
Use keywords strategy and matrix in that order.
Last line should be node-version: ${{ matrix.node-ver}}
Reference:
https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/run-job- variations
質問 # 70
......
GH-200試験練習テスト問題:https://jp.fast2test.com/GH-200-premium-file.html
合格させるGH-200試験情報と無料練習テスト:https://drive.google.com/open?id=1AiI4dlNVxp6ToK_hO5D-TKbipr6QGbke