Skip to content

Commit

Permalink
fix: linode jenkinsfile and log level adjust / comment add (#194)
Browse files Browse the repository at this point in the history
* fix: update log level and add comment to clarify print stmt

* fix: add closing braces for Linode Jenkinsfile

* fix: cosmetic fix for || construct
  • Loading branch information
Jason Schmidt authored Aug 30, 2022
1 parent 181c439 commit cfee4be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions extras/jenkins/Linode/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ pipeline {
*/

sh '''
$WORKSPACE/pulumi/python/runner -p linode -s marajenklke${BUILD_NUMBER destroy
$WORKSPACE/pulumi/python/runner -p linode -s marajenklke${BUILD_NUMBER} destroy
find $WORKSPACE -mindepth 2 -maxdepth 6 -type f -name Pulumi.yaml -execdir pulumi stack rm marajenklke${BUILD_NUMBER} --force --yes \\;
'''
}
Expand All @@ -187,7 +187,7 @@ pipeline {

sh '''
# Destroy our partial build...
$WORKSPACE/pulumi/python/runner -p linode -s marajenklke${BUILD_NUMBER destroy|| true
$WORKSPACE/pulumi/python/runner -p linode -s marajenklke${BUILD_NUMBER} destroy || true
# Clean up the Pulumi stack
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 \\;
'''
Expand Down
6 changes: 4 additions & 2 deletions pulumi/python/automation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ def write_env(env_config, stack_name):
"""Create a new environment file and write our stack to it"""
with open(env_config.filename, 'w') as f:
try:
# Note that we are printing to a file here, not STDOUT
print("PULUMI_STACK=" + stack_name, file=f)
msg = 'Environment configuration file not found. Creating new file at the path: %s'
RUNNER_LOG.error(msg, env_config.filename)
RUNNER_LOG.info(msg, env_config.filename)
except (FileNotFoundError, PermissionError):
RUNNER_LOG.error("Unable to build configuration file")
sys.exit(2)
Expand All @@ -113,8 +114,9 @@ def append_env(env_config, stack_name):
with open(env_config.config_path, 'a') as f:
try:
msg = 'Environment configuration file does not contain PULUMI_STACK, adding'
# Note that we are printing to a file here, not STDOUT
print("PULUMI_STACK=" + stack_name, file=f)
RUNNER_LOG.error(msg)
RUNNER_LOG.info(msg)
except (FileNotFoundError, PermissionError):
RUNNER_LOG.error("Unable to append to configuration file")
sys.exit(2)
Expand Down

0 comments on commit cfee4be

Please # to comment.