Skip to content
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

feat(3143): Add regex for stage setup or teardown job names #574

Conversation

ThehamzaIftikhar
Copy link
Contributor

Context

No regex exists to check if a job is one of stage setup or teardown

Objective

Add regex to check if a job is a stage setup or teardown

References

screwdriver-cd/screwdriver#3143

License

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

VonnyJap
VonnyJap previously approved these changes Aug 8, 2024
config/regex.js Outdated
STAGE_SETUP_PATTERN: /^stage@([\w-]+):setup$/
STAGE_SETUP_PATTERN: /^stage@([\w-]+):setup$/,
// Stage setup pattern. Can be stage@stage-name:setup or stage@stage-name:teardown
STAGE_SETUP_TEARDOWN_PATTERN: /^stage@([\w-]+):(setup|teardown)$/
Copy link
Member

Choose a reason for hiding this comment

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

Lets move this where the regex related to job names are declared.
May be after PR_JOB_NAME

Suggested change
STAGE_SETUP_TEARDOWN_PATTERN: /^stage@([\w-]+):(setup|teardown)$/
STAGE_SETUP_TEARDOWN_JOB_NAME: /^stage@([\w-]+):(setup|teardown)$/

});

it('does not match invalid stage setup or teardown jobs', () => {
['stage@alpha', 'alpha-deploy', 'alpha:setup', 'stage@setup'].forEach(trigger => {
Copy link
Member

Choose a reason for hiding this comment

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

Add more samples stage@alpha:deploy, stage@teardown, sd@1234:stage@alpha:setup, sd@1234:stage@alpha:teardown

config/regex.js Outdated
@@ -45,6 +45,8 @@ module.exports = {
JOB_NAME: /^(([\w-]+)|(?:stage@([\w-]+):(setup|teardown)))$/,
// PR JOB Name can only be PR-1 or PR-1:main, group1: PR-prNum, group2: jobName
PR_JOB_NAME: /^(PR-\d+)(?::([\w-]+))?$/,
// Stage setup pattern. Can be stage@stage-name:setup or stage@stage-name:teardown
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Stage setup pattern. Can be stage@stage-name:setup or stage@stage-name:teardown
// Stage setup or teardown job name. Can be stage@stage-name:setup or stage@stage-name:teardown

@sagar1312 sagar1312 changed the title feat(3143): Add regex for stage setup or teardown jobs feat(3143): Add regex for stage setup or teardown job names Aug 8, 2024
@sagar1312 sagar1312 merged commit 682ad4e into master Aug 8, 2024
2 checks passed
@sagar1312 sagar1312 deleted the hiftikhar01_feat_3413_define_regex_for_stage_setup_or_teardown_jobs branch August 8, 2024 19:09
@sd-buildbot
Copy link

🎉 This PR is included in version 23.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants