1

Is there a way to store custom information, for example my staging environment ID. I need this information for cleanup purposes later after the staging environment is no longer needed.

Ideally, I want a database table where I have these columns, buildName, buildCommit, pullRequest.

Then when the pull request is closed/merged I can simply find all buildNames and buildCommits for that pull request and remove them.

1 Answer 1

1

If you want to use a database, you can always shell out to a database:

sh "mysql -u my_username -p my_password -h my_hostname -P 3306 -e \'INSERT INTO my_table (column1, column2, ...) VALUES (value1, value3, ...);\'  my_database"

You can also write out your data to a JSON or YAML or whatever type of file and then store it in Jenkins' built-in artifact storage with archiveArtifacts.

1
  • how can i use this with postgres database installed in same server of jenkis ? May 3, 2021 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.