stable

Clone or download

Read-only

Store GitLab webhook id

The id of the GitLab webhook we create is now stored in the database. It will be used later to be able to remove it (dedicated patch). This changes the sequence of webhook creation. Before: 1. Generate a new webhook secret for the repository 2. Save it in DB 3. Create a new webhook in corresponding GitLab project Now, the secret is saved alongside the webhook id: 1. Generate a new webhook secret for the repository 2. Create a new webhook in corresponding GitLab project and get its id 3. Save id+secret in DB This means that if we are not able to create the webhook (GitLab server error), then the secret is not anymore saved. This change is transparent for the user. You can assert that the webhook id is properly saved by comparing the id of the webhook on GitLab project, and the id we saved for the repository. Part of story #17182: reference tuleap artifacts in gitlab merge requests Change-Id: I55027350807d27cdde79ab5cd4bfc5a9c24f788c

Modified Files

Name
M plugins/gitlab/db/install.sql +3 −2 Go to diff View file
A plugins/gitlab/db/mysql/2021/202101211225_store_gitlab_webhook_id.php +54 −0 Go to diff View file
M plugins/gitlab/include/REST/v1/GitlabRepositoryResource.php +7 −8 Go to diff View file
M plugins/gitlab/include/Repository/GitlabRepositoryDeletor.php +6 −6 Go to diff View file
D plugins/gitlab/include/Repository/Webhook/Secret/SecretGenerator.php +0 −59 Go to diff View file
M plugins/gitlab/include/Repository/Webhook/Secret/SecretRetriever.php +4 −3 Go to diff View file
A plugins/gitlab/include/Repository/Webhook/WebhookCreationException.php +27 −0 Go to diff View file
M plugins/gitlab/include/Repository/Webhook/WebhookCreator.php +67 −25 Go to diff View file
R plugins/gitlab/include/Repository/Webhook/Secret/SecretDao.php Go to diff View file
M plugins/gitlab/include/gitlabPlugin.php +2 −2 Go to diff View file
M plugins/gitlab/tests/unit/Repository/GitlabRepositoryDeletorTest.php +7 −7 Go to diff View file
A plugins/gitlab/tests/unit/Repository/Webhook/WebhookCreatorTest.php +204 −0 Go to diff View file