stable

Clone or download

Read-only

Update bot api token

Go to GitLab project that is integrated in Tuleap and that already received some comment from Tuleap (to add links to artifacts). Revoke the access token used by Tuleap. Commit with a link to an artifact (tuleap-xxx). => No link is added as comment to the commit. => In the logs you have "An error occurred during automatically comment commit" Now create a new access token, copy the token and issue the following REST API request: ``` PATCH /gitlab_repositories { "update_bot_api_token": { "gitlab_bot_api_token" : "The new token", "full_url" : "https://gitlab.example.com/path-to/project", "gitlab_internal_id" : 123 } } ``` Where 123 is the id of your GitLab project, and "The new token" the one you copied just before. Full url is given by corresponding entry in GET projects/:id/gitlab_repositories Commit with a link to an artifact (tuleap-xxx). => In the logs you have "Comment was successfully added" => Links are added as comment to the commit Now try to insert an invalid access token. The REST rout should return an error and the invalid token is not saved in the database. Part of story #17182: reference tuleap artifacts in gitlab merge requests Change-Id: I8f6d4adf6629c67f009fdf81c8a542d4a6964644

Modified Files

Name
M plugins/gitlab/include/API/GitlabRequestException.php +11 −0 Go to diff View file
A plugins/gitlab/include/REST/v1/BotApiTokenUpdater.php +127 −0 Go to diff View file
A plugins/gitlab/include/REST/v1/ConcealedBotApiTokenPatchRepresentation.php +53 −0 Go to diff View file
A plugins/gitlab/include/REST/v1/GitlabRepositoryBotApiTokenPatchRepresentation.php +44 −0 Go to diff View file
A plugins/gitlab/include/REST/v1/GitlabRepositoryPatchRepresentation.php +34 −0 Go to diff View file
M plugins/gitlab/include/REST/v1/GitlabRepositoryResource.php +63 −9 Go to diff View file
M plugins/gitlab/include/Repository/GitlabRepository.php +5 −0 Go to diff View file
M plugins/gitlab/include/Repository/Token/GitlabBotApiTokenDao.php +7 −3 Go to diff View file
M plugins/gitlab/include/Repository/Webhook/PostPush/PostPushCommitCredentialsRetriever.php +1 −3 Go to diff View file
M plugins/gitlab/site-content/fr_FR/LC_MESSAGES/tuleap-gitlab.po +15 −0 Go to diff View file
A plugins/gitlab/tests/unit/REST/v1/BotApiTokenUpdaterTest.php +351 −0 Go to diff View file
A plugins/gitlab/tests/unit/Repository/GitlabRepositoryTest.php +45 −0 Go to diff View file
M plugins/gitlab/tests/unit/Repository/Webhook/PostPush/PostPushCommitCredentialsRetrieverTest.php +3 −10 Go to diff View file