Updating the Jenkins Personal Access Token

The Jenkins PAT

The Jenkins personal access token is used by Jenkins to retrieve Git repo information and send status checks during pipeline runs.

To generate a new token, navigate a web browser to the team Github, and click the gh-logo at the top right of the screen.

UserIconClick UserIconClick

Click ‘Settings’ in the dropdown.

SettingsClick SettingsClick

At the bottom left of the Settings page, click ‘Developer Settings.’

DevSettingsClick DevSettingsClick

Click the ‘Personal access tokens’ dropdown, and click ‘Tokens (classic)’.

PATClick PATClick

Generating a New Token

To generate a new token, follow these steps. If you just need to regenerate an existing token, skip down to the following section.

To generate a new token, click the ‘Generate new token’ dropdown near the top right of the Personal access tokens (classic) screen. In the dropdown, click ‘Generate new token (classic).’

GNTDropdown GNTDropdown

You will be prompted to enter your FortiAuthenticator TOTP code. Enter it, and on the New personal access token (classic) page, ensure the following permissions are checked:

  • repo and all of its sub-options:

    RepoPerms RepoPerms

  • admin:repo_hook and all of its sub-options:

    AdminPerms AdminPerms

Choose an expiration date, optionally add a note, and click gen-tkn at the bottom of the screen.

Note: When the token appears on the next screen, ensure you copy and paste it somewhere where you can retrieve it before navigating away from the screen or closing the tab. Once you do, you will not be able to retrieve the token again and will need to generate another.

Regenerating an Existing Token

To regenerate an existing token, from the Personal access tokens (classic) screen, click the name of the token. For example:

PATTokenExample PATTokenExample

On the following screen, ensure the requisite permissions are selected, and click ‘Regenerate token’, and copy the token someplace handy where you can retrieve it later.

RegenToken RegenToken

Updating Jenkins

Navigate to the FortinetCloudCSE Jenkins server, and login with your credentials. To update a token, you’ll need admin permissions.

Jenkins-login Jenkins-login

After logging in, click ‘Manage Jenkins’ on the left hand side of the screen.

ManageJenkins ManageJenkins

On the Manage Jenkins screen, under the Security heading, click ‘Credentials’.

ClickCredsJenkins ClickCredsJenkins

On the Credentials page, click the name of the token you want to update. Then, click ‘Update’ on the left menu.

UpdateToken UpdateToken

Click ‘Change Password’, paste in the new token, and click jenk-sv-btn.

Confirm the token works

Click the ‘Manage Jenkins’ breadcrumb at the top of the screen.

MJBreadcrumb MJBreadcrumb

Click ‘System’ under the System Configuration heading on the Manage Jenkins page.

MJSystem MJSystem

Scroll down to the Github section towards the center of the page.

GithubServers GithubServers

Select the credential that references the token you just updated, and click test-conn-btn.

If the token is valid and working, you should see a message appear such as Credentials verified for user… as in the image below.

CredsVer CredsVer