stable

Clone or download

Read-only

Insert GitLab bot API token

This is part of story #17182 reference tuleap artifacts in gitlab merge requests This patch is the start of having a bot on GitLab to allow automatically comments on commits and Merge request with (for example): "This commit references: [TULEAP-XXX](tuleap_url)" To have this bot, it is necessary to save a project API token which will used to use GitLab API and create comments[0]. This project token replaces initial user token. In next patches: - Use this token to create comment in the commit, when a push event is received - Use this token to create comment in Merge Request, when a merge request revent is received How to test: - make dev-forgeupgrade - You need to have a GitLab instance - You need to have a project API token. You can create it: - In your GitLab Project setting => Access Tokens => Generate API token with API Scope - Insert a new repository in a Tuleap project Expected Results: - Your bot API token is saved in plugin_gitlab_bot_api_token table - The token is encrypted => If you delete the last integrated repository, then the token will be deleted too. => If you delete an integrated repository, but it is still integrated in other projects, then the token is not deleted [0]https://docs.gitlab.com/ee/api/commits.html#post-comment-to-commit Change-Id: I16e343d29514df92950bfb8d898d7d5eee9d39fc

Modified Files

Name
M plugins/git/scripts/repositories/po/fr.po +7 −7 Go to diff View file
M plugins/git/scripts/repositories/src/api/rest-querier.js +2 −2 Go to diff View file
M plugins/git/scripts/repositories/src/api/rest-querier.test.js +3 −3 Go to diff View file
M plugins/git/scripts/repositories/src/components/GitlabModal/CreateGitlabLinkModal/CredentialsFormModal.test.js +8 −8 Go to diff View file
M plugins/git/scripts/repositories/src/components/GitlabModal/CreateGitlabLinkModal/CredentialsFormModal.vue +11 −11 Go to diff View file
M plugins/git/scripts/repositories/src/components/GitlabModal/CreateGitlabLinkModal/GitlabRepositoryModal.vue +5 −5 Go to diff View file
M plugins/git/scripts/repositories/src/components/GitlabModal/CreateGitlabLinkModal/ListRepositoriesModal.vue +2 −2 Go to diff View file
M plugins/gitlab/db/install.sql +5 −0 Go to diff View file
A plugins/gitlab/db/mysql/202101071404_create_plugin_gitlab_bot_api_token_table.php +51 −0 Go to diff View file
M plugins/gitlab/db/uninstall.sql +1 −0 Go to diff View file
M plugins/gitlab/include/API/Credentials.php +5 −5 Go to diff View file
M plugins/gitlab/include/API/GitlabHTTPClientFactory.php +1 −1 Go to diff View file
M plugins/gitlab/include/REST/v1/GitlabRepositoryPOSTRepresentation.php +1 −15 Go to diff View file
M plugins/gitlab/include/REST/v1/GitlabRepositoryResource.php +10 −5 Go to diff View file
M plugins/gitlab/include/Repository/GitlabRepositoryCreator.php +10 −1 Go to diff View file
M plugins/gitlab/include/Repository/GitlabRepositoryDeletor.php +9 −1 Go to diff View file
A plugins/gitlab/include/Repository/Token/GitlabBotApiTokenDao.php +46 −0 Go to diff View file
A plugins/gitlab/include/Repository/Token/GitlabBotApiTokenInserter.php +57 −0 Go to diff View file
M plugins/gitlab/tests/unit/Repository/GitlabRepositoryCreatorTest.php +15 −4 Go to diff View file
M plugins/gitlab/tests/unit/Repository/GitlabRepositoryDeletorTest.php +9 −1 Go to diff View file
A plugins/gitlab/tests/unit/Repository/Token/GitlabBotApiTokenInserterTest.php +93 −0 Go to diff View file