4.4 KiB
Configure credentials for GitHub Actions Importer
In this lab, you will use the configure CLI command to set the required credentials and information for GitHub Actions Importer to use when working with GitLab and GitHub.
You will need to complete all of the setup instructions here prior to performing this lab.
Configuring credentials
-
Run the setup script in the codespace terminal to ensure the GitLab server is ready:
./gitlab/bootstrap/setup.sh -
Open the GitLab server in a new browser tab: - Click the
PORTStab in the codespace terminal window. - In thePORTStab find the row for port 80. - Hover over the address under theLocal Addresscolumn and click the globe to "open in browser". -
Create a GitLab personal access token (PAT): - Authenticate with the GitLab server using the following credentials: - Username:
root- Password:actions-importer-labs!- Follow the GitLab instructions to generate a PAT. - Ensure the token has theread_apiscope. - Copy the generated token and save it in a safe location. -
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, clickDeveloper Settings. - ClickPersonal access tokensand thenLegacy tokens(if present). - ClickGenerate new tokenand thenGenerate new legacy token. You may be required to authenticate with GitHub during this step. - Name your token in theNotefield. - Select the following scopes:workflowandread:packages. - ClickGenerate token. - Copy the generated PAT and save it in a safe location. -
Run the
configureCLI command: - Select theTERMINALtab from within the codespace terminal window. - Run the following command:gh actions-importer configure. - Use the down arrow key to highlightGitLab, press the spacebar to select, and then press enter to continue. - At the GitHub handle prompt, enter the GitHub handle used to generate the GitHub PAT in step 2 and press enter. - At the GitHub Container Registry prompt, enter the GitHub PAT generated in step 4 and press enter. - At the GitHub PAT prompt, enter the GitHub PAT generated in step 4 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 GitLab token prompt, enter the GitLab access token from step 3 and press enter. - At the GitLab URL prompt, enterhttp://localhostand press enter.```console $ gh actions-importer configure ✔ Which CI providers are you configuring?: GitLab Enter the following values (leave empty to omit): ✔ GitHub handle used to authenticate with the GitHub Container Registry: mona ✔ Personal access token to authenticate with the GitHub Container Registry: *************** ✔ Personal access token for GitHub: *************** ✔ Base url of the GitHub instance: https://github.com ✔ Private token for GitLab: *************** ✔ Base url of the GitLab instance: http://localhost Environment variables successfully updated. ```
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 GitHub Actions Importer to your codespace.
-
In the codespace terminal run the following command:
gh actions-importer update -
You should see a confirmation that you were logged into the GitHub Container Registry and the image was updated to the latest version.
$ gh actions-importer update Login Succeeded latest: Pulling from actions-importer/cli Digest: sha256:a7d00dee8a37e25da59daeed44b1543f476b00fa2c41c47f48deeaf34a215bbb Status: Image is up to date for ghcr.io/actions-importer/cli:latest ghcr.io/actions-importer/cli:latest