This repository was archived by the owner on Oct 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 103
chore: jenkins fixes and general cleanup of jenkinsfiles #161
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
10e528e
fix: typo in find command was causing pulumi stacks to not be deleted
1a35bc3
fix: formatting and find syntax in jenkins (esc for Groovy)
30b598f
fix: formatting and find syntax in jenkins (esc for Groovy)
d0cd8fd
Merge remote-tracking branch 'qdzlug/jenkinsfix' into jenkinsfix
275c2c8
chore: clean up the comments a bit
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,23 +69,23 @@ pipeline { | |
| # Create the directory for the kubeconfig | ||
| mkdir -p $HOME/.kube || true | ||
| chmod 777 $HOME/.kube || true | ||
| ''' | ||
| ''' | ||
| } | ||
| } | ||
|
|
||
| stage('Cleaning Up') { | ||
| steps { | ||
|
|
||
| /* | ||
| * Run a find and check for any stacks that currently exist with our generated stack name; this should not | ||
| * happen in normal operation, but could potentially happen if things break so better safe than sorry. | ||
| * This is currently empty since we are building a new executor for each run. However, maintaining | ||
| * here for anyone who wants to add cleanup steps for their environment | ||
| * | ||
| * Other cleanup related functions can be placed here as well. | ||
| */ | ||
|
|
||
| sh ''' | ||
| # Clean up the Pulumi stack if it exists for our run - which it shouldn\'t, but you never know. | ||
| find $WORKSPACE -mindepth 2 -maxdepth 7 -type f -name Pulumi.yaml -execdir $WORKSPACE/pulumi/python/venv/bin/pulumi stack rm marajenklke${BUILD_NUMBER} --force --yes \\; | ||
| # Just return... | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I think this comment isn't adding anything the better comment above doesn't
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in the last push; I also made a note to go through the jenkinsfiles and do a cleanup with the idea of writing it up either for an in-repo note or as a blog post... |
||
| true | ||
| ''' | ||
|
|
||
| } | ||
|
|
@@ -132,7 +132,7 @@ pipeline { | |
| $WORKSPACE/pulumi/python/venv/bin/pulumi config set prometheus:adminpass "password" -C pulumi/python/config -s marajenklke${BUILD_NUMBER} | ||
| $WORKSPACE/pulumi/python/venv/bin/pulumi config set prometheus:helm_timeout "600" -C pulumi/python/config -s marajenklke${BUILD_NUMBER} | ||
| $WORKSPACE/pulumi/python/venv/bin/pulumi config set linode:token "${LINODE_TOKEN}" --plaintext -C pulumi/python/config -s marajenklke${BUILD_NUMBER} | ||
| ''' | ||
| ''' | ||
|
|
||
| } | ||
| } | ||
|
|
@@ -165,7 +165,7 @@ pipeline { | |
|
|
||
| sh ''' | ||
| PATH=$WORKSPACE/pulumi/python/venv/bin:$PATH $WORKSPACE/bin/destroy.sh | ||
| find . -mindepth 2 -maxdepth 6 -type f -name Pulumi.yaml -execdir pulumi stack rm marajenklke${BUILD_NUMBER} --force --yes \\; | ||
| find $WORKSPACE -mindepth 2 -maxdepth 6 -type f -name Pulumi.yaml -execdir pulumi stack rm marajenklke${BUILD_NUMBER} --force --yes \\; | ||
| ''' | ||
| } | ||
| } | ||
|
|
@@ -180,11 +180,11 @@ pipeline { | |
| */ | ||
|
|
||
| sh ''' | ||
| # Destroy our partial build... | ||
| $WORKSPACE/bin/destroy.sh || true | ||
| # Clean up the Pulumi stack if it exists for our run - which it shouldn\'t, but you never know. | ||
| find $WORKSPACE -mindepth 2 -maxdepth 7 -type f -name Pulumi.yaml -execdir $WORKSPACE/pulumi/python/venv/bin/pulumi stack rm marajenk${BUILD_NUMBER} --force --yes \; | ||
| ''' | ||
| # Destroy our partial build... | ||
| $WORKSPACE/bin/destroy.sh || true | ||
| # Clean up the Pulumi stack if it exists for our run - which it shouldn\'t, but you never know. | ||
| find $WORKSPACE -mindepth 2 -maxdepth 7 -type f -name Pulumi.yaml -execdir $WORKSPACE/pulumi/python/venv/bin/pulumi stack rm marajenklke${BUILD_NUMBER} --force --yes \\; | ||
| ''' | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we remove the double backslash in a previous PR? Just want to make sure that this is what we want Also curious what the double backslash means?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an interesting journey. If you pick up that line with \ and run it directly (like in the UDF scripts), the command fails because find wants to see
\;at the end of the line.\\;escapes the\and leaves you with;which the shell interprets as the end of the line, and theexecdirnever runs.So, what I noticed happening is stacks not being cleaned up, saw the
\\, tested it locally, and thought "Aha! That is the issue! I shall fix that!"Well, the fix worked for the scripting but bombed out in Jenkins. Becuase....the
\is a reserved character in the Groovy scripting language, which is used by Jenkins. Which then led me to the actual problem, which is that I was usingpulumiwithout giving a path, and in Jenkins that meant "command not found" but we have a|| truein case it can't find anything.....So, this should fix all the issues above, and if my past PR's are any indication I'm sure this will introduce another bug...