Skip to content

Conversation

@aFlyBird0
Copy link
Member

@aFlyBird0 aFlyBird0 commented Aug 3, 2022

Signed-off-by: Bird aflybird0@gmail.com

Description

I created a new plugin in #921 to automatically create a Jenkins Job triggered by GitHub.

This pr is here to fix it.

Although the code looks weird, in the short term, it's the easiest and quickest way to fix it.

After a lot of troubleshooting, here's why I couldn't automatically generate the webhook

The first step is to create a ConfigMap to generate JCasC, which has a setting manageWebhooks: true to automatically create a webhook for the GitHub repo when you create a job, and the second step is to create a Jenkins job.

The problem is that after creating the ConfigMap in step 1, you need to poll the ConfigMap via sidecar to convert it to JCasC, so the manageWebhooks configuration takes effect after the job is created.

We just need to make sure that we create the job after the configuration takes effect. The current strategy is to sleep for 3 seconds.

Of course, the best strategy is to poll the latest JCasC and create the job as soon as the configuration takes effect, but considering that we need to spend time testing the project near the release, and that Jenkins installation itself is a very time-consuming task, it is acceptable to wait three seconds longer than that.

Related Issues

#921

New Behavior (screenshots if needed)

Signed-off-by: Bird <aflybird0@gmail.com>
@aFlyBird0 aFlyBird0 marked this pull request as ready for review August 3, 2022 18:01
@aFlyBird0 aFlyBird0 requested a review from a team as a code owner August 3, 2022 18:01
@aFlyBird0 aFlyBird0 requested review from iyear and steinliber August 4, 2022 04:51
@aFlyBird0
Copy link
Member Author

@steinliber PTAL 🙌

@steinliber steinliber merged commit 44f9865 into devstream-io:main Aug 4, 2022
@aFlyBird0 aFlyBird0 deleted the fix-auto-create-webhook branch August 12, 2022 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants