Skip to content

Conversation

kerogers-cloudbees
Copy link

… marker is present.

// MAIN CODE BODY
info("Checking for first run inside an OCI container");
// The Dockerfile will need to create this file. It will prevent this script from running.
noRunFilePath = "/var/jenkins_home/init.groovy.d/DO_NOT_RUN_UC_REMEDIATION";
Copy link
Contributor

Choose a reason for hiding this comment

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

I would store this marker file outside of the init.groovy folder in case jenkins tries to "run" it during the initial install

if (noRunFile.exists()) {
info("Found marker file for first run. Removing file and exiting")
noRunFile.delete()
return "NO_CHANGE_NEEDED"
Copy link
Contributor

Choose a reason for hiding this comment

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

return "SKIPPING_FIRST_RUN"

Copy link
Author

Choose a reason for hiding this comment

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

do I need to add it to the list of ok returns or have it handle that as an error?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, probably. i'd treat it as a success

RUN mkdir -p /var/jenkins_home/init.groovy.d
COPY ./ucCertRemediation.groovy /var/jenkins_home/init.groovy.d/

RUN touch /var/jenkins_home/init.groovy.d/DO_NOT_RUN_UC_REMEDIATION && \
Copy link
Contributor

Choose a reason for hiding this comment

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

suggest not storing this in the init.groovy.d folder so that jenkins doesn't try to run it

Copy link
Author

Choose a reason for hiding this comment

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

Good plan

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.

2 participants