3.9 KiB
Configure credentials for Valet
In this lab, we will use the Valet configure command to set up the required information to communicate with Azure DevOps and GitHub. The configure command can be used for all of the supported providers, but in this lab we will be focusing on Azure DevOps.
Prerequisites
- Followed steps to set up your codespace environment.
Configuring Valet
-
Create a GitHub personal access token (PAT).
- Navigate to your GitHub
Settings- click your profile photo and then clickSettings. - Go to
Developer Settings - Go to
Personal Access Tokens->Legacy tokens (if present) - Click
Generate new token->Legacy tokens (if present). If required, provide your password. - Select at least these scopes:
read packagesandworkflow. Optionally, provide text in the Note field and change the expiration. - Click
Generate token - Copy the token somewhere safe and temporary.
- Navigate to your GitHub
-
Skip this step if you still have the Azure DevOp personal access token created during step 1 in the lab setup steps, if not create another and save to a save and temporary location.
-
Run Valet configure command.
- In the codespace terminal run
gh valet configure - Use the down arrow key to highlight
Azure DevOps, press the spacebar to select, then hit enter to accept. - At the prompt enter your GitHub username and press enter.
- At the GitHub Container Registry prompt enter the GitHub PAT generated in step 1 and press enter.
- At the GitHub PAT prompt enter the GitHub PAT generated in step 1 and press enter.
- At the GitHub url prompt enter the GitHub instance url or hit enter to accept the default.
- At the Azure DevOps token prompt enter the access token from step 2 and press enter.
- At the Azure DevOps url prompt enter your Azure DevOps url or hit enter to accept the default.
- At the prompt enter your Azure Devops Organization name.
- At the prompt enter your Azure Devops Project name.
- In the codespace terminal run
-
If all went well you should see a similar output in your terminal and a new file (.env.local) should have been created in the root of the project. The .env.local file contains the tokens used during the configure command and should be keep secret.
Verify Valet Works
To verify Valet works we are going to run a update, version and dry-run command. We will go further into details about the dry-run command in a later lab, but for now we want to get the latest version of Valet and confirm that Valet can perform a dry-run with no errors.
-
In the codespace terminal update Valet by running
gh valet update -
In the terminal you should see a confirmation that it logged into the GitHub Container Registry and pulled the latest version.
-
To verify Valet is updated and installed correctly run
gh valet versionand confirm the command outputs a similar response -
Next, lets run the dry-run command in the codespaces terminal, to verify we can talk to Azure DevOps
gh valet dry-run azure-devops pipeline -o tmp/configure_test --pipeline-id 7 -
In the terminal you should see the command was successful, if not it is a good time to practice the configure command again and make sure the access tokens values are correct and generated with the correct permissions.


