You have a Git Hub repository that contains workflows. The workflows contain steps that execute predefined actions. Each action has one or more versions.You need to request the specific version of an action to execute.Which three attributes can you use to identify the version? Each correct answer presents a complete solution.Note: Each correct selection is worth one point.
Answer(s): B,C,E
We strongly recommend that you include the version of the action you are using by specifying a Git ref, SHA [B], or Docker tag[E]. If you don't specify a version, it could break your workflows or cause unexpected behavior when the action owner publishes an update.* Using the commit SHA of a released action version is the safest for stability and security.* If the action publishes major version tags, you should expect to receive critical fixes and security patches while still retaining compatibility. Note that this behavior is at the discretion of the action's author.* Using the default branch of an action may be convenient, but if someone releases a new major version with a breaking change, your workflow could break.Example: Using a public action{owner}/{repo}@{ref}You can specify a branch[C], ref, or SHA[B] in a public GitHub repository.jobs:my_first_job:steps:- name: My first step# Uses the default branch of a public repository uses: actions/heroku@main- name: My second step# Uses a specific version tag of a public repository uses: actions/aws@v2.0.1
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions
DRAG DROP (Drag and Drop is not supported)You have a GitHub repository that contains the code for an app named App1.App1 depends on a library of functions from a repository at https://github.com/contoso/afeed.You need to keep a clone of the afeed repository as a subdirectory of the App1 repository.How should you complete the Git command? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.Note: Each correct selection is worth one point.Select and Place:
Answer(s): A
The git submodule add command adds another Git repository as a submodule within the current repository. This allows App1 to maintain the afeed repository as a subdirectory while tracking it as a separate Git repository.
HOTSPOT (Drag and Drop is not supported)You use Git for source control.You need to optimize the performance of a repository. The solution must meet the following requirements:-Permanently remove all items referenced only in the reflog.-Remove history that is NOT in any current branch.How should you complete the command? To answer, select the appropriate options in the answer area.Note: Each correct selection is worth one point.Hot Area:
Box 1: reflogPermanently remove all items referenced only in the reflog.You need, specifically, the --expire-unreachable option:git reflog expire --expire=90.days.ago --expire-unreachable=now --allBox 2: gcRemove history that is NOT in any current branch.In most cases, users will not need to call git prune directly, but should instead call git gc, which handles pruning along with many other housekeeping tasks.git-gc - Cleanup unnecessary files and optimize the local repositorySYNOPSISgit gc [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force] [--keep-largest-pack]Options include:--prune=<date>Prune loose objects older than date (default is 2 weeks ago, overridable by the config variable gc.pruneExpire). --prune=now prunes loose objects regardless of their age and increases the risk of corruption if another process is writing to the repository concurrently; see "NOTES" below. --prune is on by default.Box 3: now
https://stackoverflow.com/questions/49067898/git-remove-old-reflog-entries https://git-scm.com/docs/git-prune https://git-scm.com/docs/git-gc
DRAG DROP (Drag and Drop is not supported)You create a Git repository named Repo1 in Azure Repos.You need to configure Repo1 to meet the following requirements:-Work items must be linked to a pull request.-Pull requests must have a minimum of two reviewers.-Pull requests must complete a code review by using a third-party tool.The solution must minimize administrative effort.Which type of policy should you use for each requirement? To answer, drag the appropriate policy types to the correct requirements. Each type policy may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.Note: Each correct selection is worth one point.Select and Place:
Box 1: Check-inWork items must be linked to a pull request.In the Add Check-in Policy dialog box, select the policy types you want, and then select OK.You can select from the following policies:*-> Work Items requires that one or more work items be associated with every check-in.Builds requires that the last build was successful before any new changes can be checked in.Changeset Comments Policy requires users to provide check-in comments.Code Analysis requires that code analysis be run before code can be checked in.Custom Path Policy scopes the other policies to specific folders or file types.Forbidden Patterns Policy prevents check-ins that have files with forbidden filename patterns.Work Item Query Policy specifies a work item query whose results are the only legal work items to associate with a check-in.Box 2: StatusPull requests must complete a code review by using a third-party tool.A status policy requires that an external service posts a status to the pull request. In this case, the external service could be SonarCloud. SonarCloud can analyze the code and check whether it meets the defined quality standards (Quality Gates). If it does, SonarCloud can then post a Passed status to the pull request. The status policy will then check this status before allowing the pull request to be merged.Box 3 BranchPull requests must have a minimum of two reviewers.Require a minimum number of reviewersCode reviews are important for software development projects. To ensure that teams review and approve PRs, you can require approval from a minimum number of reviewers. The basic policy requires that a specified number of reviewers approve the code, with no rejections.To set the policy, under Branch Policies, set Require a minimum number of reviewers to On. Enter the required number of reviewers, and select any of the following options:
https://learn.microsoft.com/bs-latn-ba/azure/devops/repos/tfvc/add-check-policies https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies https://azuredevopslabs.com/labs/vstsextend/sonarcloud/
SIMULATIONInitialize the default main branch, if it does not exist already.In the User1-12345678 Azure DevOps project, you need to implement an approval process for the default main branch.The process must use the four-eyes principle and have at least one approval on every iteration.
See explanation below.Azure DevOps, Azure Repos, Branch policies and settingsConfigure branch policiesPhase 1. Select the correct branchStep 1: To manage branch policies, select Repos > Branches to open the Branches page in the web portal.(You can also get to branch policy settings with Project Settings > Repository > Policies > Branch Policies > <Branch Name>.)Step 2: To set branch policies, locate the branch you want to manage. You can browse the list or search for your branch in the Search branch name box at upper right. [Select the default main branch]Select the More options icon next to the branch, and then select Branch policies from the context menu.Phase 2: Configure approvalRequire a minimum number of reviewersCode reviews are important for software development projects. To ensure that teams review and approve PRs, you can require approval from a minimum number of reviewers. The basic policy requires that a specified number of reviewers approve the code, with no rejections.Step 3: To set the policy, under Branch Policies, set Require a minimum number of reviewers to On. Enter the required number of reviewers, and select any of the following options:3a. [Select: Minimum number of reviewers: 2]3b. [Select: When new changes are pushed:]3c [Select Require at least one approval on the last approval of the last iternation]
https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies
Post your Comments and Discuss Microsoft AZ-400 exam prep with other Community members:
Our website is free, but we have to fight against AI bots and content theft. We're sorry for the inconvenience caused by these security measures. You can access the rest of the AZ-400 content, but please register or login to continue.