Answers: <p>If you want to use a database, you can always shell out to a database:</p>
  <pre><code>sh &quot;mysql -u my_username -p my_password -h my_hostname -P 3306 -e \'INSERT INTO my_table (column1, column2, ...) VALUES (value1, value3, ...);\'  my_database&quot;
  </code></pre>
  <p>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 <a href="https://www.jenkins.io/doc/pipeline/steps/core/#archiveartifacts-archive-the-artifacts" rel="nofollow noreferrer">archiveArtifacts</a>.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-05-03T08:05:47.697Z
Answers: how can i use this with postgres database installed in same server of jenkis ?
Answers: Youssef Boudaya
Answers: CC BY-SA 4.0
Answers: 2021-02-02T19:46:11.830Z
Answers: 2021-02-02T19:46:11.830Z
Answers: jayhendren
Body: <p>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.</p>
  <p>Ideally, I want a database table where I have these columns, <code>buildName</code>, <code>buildCommit</code>, <code>pullRequest</code>.</p>
  <p>Then when the pull request is closed/merged I can simply find all <code>buildName</code>s and <code>buildCommits</code>
  for that pull request and remove them.</p>
  
Tags: <jenkins>
Title: Jenkins: store build information for later reference
UserDisplayName: Obay Abd-Algader
ThreadText: # Jenkins: store build information for later reference
  
  (Asked by: username_0 on 2021-01-31)
  
  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 `buildName`s and `buildCommits`
  for that pull request and remove them.
  
  **Tags:** jenkins
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-02-02. Score: 1 | Accepted answer
  
  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](https://www.jenkins.io/doc/pipeline/steps/core/#archiveartifacts-archive-the-artifacts).
  
  > **Comments:**
  > **username_2**: how can i use this with postgres database installed in same server of jenkis ?  
  
  ---
  
  