Skip to content

Cronjob that creates artificial traffic for new preview environments jobs. #12663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 6, 2022

Conversation

ArthurSens
Copy link
Contributor

Description

Once ready, this PR will create a cronjob that triggers new werft jobs which, in their turn, will create new preview environments.

The final goal is that we get a little more traffic for new preview environments, so we can be more proactive when they start failing.

Related Issue(s)

Fixes #

How to test

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview

@ArthurSens
Copy link
Contributor Author

ArthurSens commented Sep 5, 2022

I'm currently failing to configure git in the job 😭 Can you identify anything I'm during wrong?

@gitpod-io/platform

Copy link
Contributor

@mads-hartmann mads-hartmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment on how I think you can fix the issue you're seeing ☺️ I also left a few other pointers and nits

echo "[Creating new branch|DONE] Trigger new job with preview environment"

echo "[Trigger new job with-preview|PHASE] Trigger new job with preview environment"
werft run github -a with-preview=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to poll for the job to finish so we can delete the branch again, otherwise we'll create a ton of branches ☺️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done a few other places, e.g here's how to workspace integration test jobs currently does it - we'd need something slightly different as we don't care if the preview environment failed or not, we still want to delete the branch.

Alternatively we'd need some other mechanism of deleting old branches. E.g. this job could even just start by delete all branches that match the pattern that are more than x hours old (that might be a more robust way to deal with it actually)

Copy link
Contributor Author

@ArthurSens ArthurSens Sep 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to poll for the job to finish so we can delete the branch again, otherwise we'll create a ton of branches ☺️

I am creating tons of branches but I'm never pushing them to origin, so it should be fine right? I don't want the previews to stick around anyway, so it will even get cleaned up faster if the branch doesn't get pushed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, I'm surprised this works to be honest 😝 I guess Werft doesn't validate that the Ref actually exist (e.g. refs/heads/platform-artificial-job-7f30eab068977bb4e4d2), and it only really cares about the Revision when checking out the code ☺️ so as long as we don't use the Ref in the build job we should be good.

The only potential downside I can think of is if we decide to GC the VM because the branch doesn't exist. I can't remember if our heuristics were updated to keep VMs alive for at least 2h ☺️

@ArthurSens ArthurSens force-pushed the as/preview-artificial-traffic branch from 0c466b0 to d027176 Compare September 6, 2022 13:05
Signed-off-by: ArthurSens <[email protected]>
@ArthurSens ArthurSens marked this pull request as ready for review September 6, 2022 13:08
@ArthurSens ArthurSens requested a review from a team September 6, 2022 13:08
@ArthurSens
Copy link
Contributor Author

ArthurSens commented Sep 6, 2022

werft log phase "Trigger new job with-preview" "Trigger new job with preview environment"
sudo chown -R gitpod:gitpod /workspace
git config --global user.name roboquat
git config --global user.email [email protected]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're not pushing to origin I wonder if we even need these three lines at all ☺️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately it is still needed :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Contributor

@mads-hartmann mads-hartmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Added hold in case you want to try to remove those git config lines

@roboquat roboquat merged commit bf59b02 into main Sep 6, 2022
@roboquat roboquat deleted the as/preview-artificial-traffic branch September 6, 2022 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants