3.5 KiB
3.5 KiB
Configure credentials for Valet
In this lab, you will use the configure CLI command to set the required credentials and information for Valet to use when working with Jenkins and GitHub.
You will need to complete all of the setup instructions here prior to performing this lab.
Configuring credentials
-
Open the Jenkins server in a new browser tab:
- Click the
PORTStab in the codespace terminal window. - In the
PORTStab, find the row for port 8080. - Hover over the address under the
Local Addresscolumn and click the globe to "open in browser".
- Click the
-
Create a Jenkins API token:
- In the top right menu bar, click the
adminbutton. - In the left panel, click the
Configuregear. - In the
API tokensection, click theAdd new Tokenbutton and clickGenerate. - Copy the generated API token and save it in a safe location.
- In the top right menu bar, click the
-
Create a GitHub personal access token (PAT):
- Open github.com in a new browser tab.
- In the top right corner of the UI, click your profile photo and click
Settings. - In the left panel, click
Developer Settings. - Click
Personal access tokensand thenLegacy tokens(if present). - Click
Generate new tokenand thenGenerate new legacy token. You may be required to authenticate with GitHub during this step. - Select the following scopes:
workflowandread:packages. - Click
Generate token. - Copy the generated PAT and save it in a safe location.
-
Run the
configureCLI command:- Select the
TERMINALtab from within the codespace terminal window. - Run the following command:
gh valet configure. - Use the down arrow key to highlight
Jenkins, press the spacebar to select, and then press enter to continue. - At the prompt, enter your GitHub username and press enter.
- At the GitHub Container Registry prompt, enter the GitHub PAT generated in step 3 and press enter.
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 3 and press enter.
- At the GitHub URL prompt, enter the GitHub instance URL or press enter to accept the default value (
https://github.com). - At the Jenkins token prompt, enter the Jenkins access token from step 2 and press enter.
- At the Jenkins URL prompt, enter
http://localhost:8080/and press enter. - At the Personal access token to fetch source code in GitHub prompt, press enter to accept the default value.
- Select the
Verify your environment
To verify your environment is configured correctly, run the update CLI command. The update CLI command will download the latest version of Valet to your codespace.
-
In the codespace terminal run the following command:
gh valet update -
You should see a confirmation that you were logged into the GitHub Container Registry and Valet was updated to the latest version.
$ gh valet update Login Succeeded latest: Pulling from valet-customers/valet-cli Digest: sha256:a7d00dee8a37e25da59daeed44b1543f476b00fa2c41c47f48deeaf34a215bbb Status: Image is up to date for ghcr.io/valet-customers/valet-cli:latest ghcr.io/valet-customers/valet-cli:latest

