Added docs for ansible and Jenkins
BIN
docs/images/integrations/jenkins/jenkins_1.png
Normal file
|
After Width: | Height: | Size: 608 KiB |
BIN
docs/images/integrations/jenkins/jenkins_10.png
Normal file
|
After Width: | Height: | Size: 425 KiB |
BIN
docs/images/integrations/jenkins/jenkins_11.png
Normal file
|
After Width: | Height: | Size: 147 KiB |
BIN
docs/images/integrations/jenkins/jenkins_12.png
Normal file
|
After Width: | Height: | Size: 548 KiB |
BIN
docs/images/integrations/jenkins/jenkins_2.png
Normal file
|
After Width: | Height: | Size: 274 KiB |
BIN
docs/images/integrations/jenkins/jenkins_3.png
Normal file
|
After Width: | Height: | Size: 197 KiB |
BIN
docs/images/integrations/jenkins/jenkins_4.png
Normal file
|
After Width: | Height: | Size: 235 KiB |
BIN
docs/images/integrations/jenkins/jenkins_5.png
Normal file
|
After Width: | Height: | Size: 208 KiB |
BIN
docs/images/integrations/jenkins/jenkins_6.png
Normal file
|
After Width: | Height: | Size: 292 KiB |
BIN
docs/images/integrations/jenkins/jenkins_7.png
Normal file
|
After Width: | Height: | Size: 514 KiB |
BIN
docs/images/integrations/jenkins/jenkins_8.png
Normal file
|
After Width: | Height: | Size: 408 KiB |
BIN
docs/images/integrations/jenkins/jenkins_9.png
Normal file
|
After Width: | Height: | Size: 429 KiB |
122
docs/integrations/cicd/jenkins.mdx
Normal file
@@ -0,0 +1,122 @@
|
||||
---
|
||||
title: "Jenkins"
|
||||
description: "How to effective and securely manage secrets in Jenkins using Infisical"
|
||||
---
|
||||
|
||||
Prerequisites:
|
||||
|
||||
- Set up and add secrets to [Infisical](https://app.infisical.com).
|
||||
- You have a working Jenkins installation with the [credentials plugin](https://plugins.jenkins.io/credentials/) installed.
|
||||
- You have the Infisical CLI installed on your Jenkins executor nodes or container images.
|
||||
|
||||
## Add Infisical Service Token to Jenkins
|
||||
|
||||
After setting up your project in Infisical and adding the Infisical CLI to container images, you will need to add the Infisical Service Token to Jenkins. Once you have generated the token, browse to **Manage Jenkins > Manage Credentials** in your Jenkins installation.
|
||||
|
||||

|
||||
|
||||
Click on the credential store you want to store the Infisical Service Token in. In this case, we're using the default Jenkins global store.
|
||||
|
||||
<Info>
|
||||
Each of your projects will have a different INFISICAL_SERVICE_TOKEN though.
|
||||
As a result, it may make sense to spread these out into separate credential domains depending on your use case.
|
||||
</Info>
|
||||
|
||||

|
||||
|
||||
Now, click Add Credentials.
|
||||
|
||||

|
||||
|
||||
Choose **Secret text** from the **Kind** dropdown menu, paste the Infisical Service Token into the **Secret** field, enter `INFISICAL_SERVICE_TOKEN` into the **Description** field, and click **OK**.
|
||||
|
||||

|
||||
|
||||
When you're done, you should have a credential similar to the one below:
|
||||
|
||||

|
||||
|
||||
|
||||
## Use Infisical in a Freestyle Project
|
||||
|
||||
To use Infisical in a Freestyle Project job, you'll need to expose the credential you created above in an environment variable. First, click New Item from the dashboard navigation sidebar:
|
||||
|
||||

|
||||
|
||||
Enter the name of the job, choose the **Freestyle Project** option, and click **OK**.
|
||||
|
||||

|
||||
|
||||
Scroll down to the **Build Environment** section and enable the **Use secret text(s) or file(s)** option. Then click **Add** under the **Bindings** section and choose **Secret text** from the dropdown menu.
|
||||
|
||||

|
||||
|
||||
Enter INFISICAL_SERVICE_TOKEN in the **Variable** field, select the **Specific credentials** option from the Credentials section and choose INFISICAL_SERVICE_TOKEN from the dropdown menu.
|
||||
|
||||

|
||||
|
||||
Scroll down to the **Build** section and choose **Execute shell** from the **Add build step** menu.
|
||||
|
||||

|
||||
|
||||
In the command field, enter the following command and click **Save**:
|
||||
|
||||
```
|
||||
infisical run -- printenv
|
||||
```
|
||||
|
||||

|
||||
|
||||
Finally, click **Build Now** from the navigation sidebar to test your new job.
|
||||
|
||||
<Info>
|
||||
Running into issues? Join Infisical's [community Slack](https://infisical.com/slack) for quick support.
|
||||
</Info>
|
||||
|
||||
|
||||
|
||||
## Use Infisical in a Jenkins Pipeline
|
||||
|
||||
To use Infisical in a Pipeline job, you'll need to expose the credential you created above as an environment variable. First, click **New Item** from the dashboard navigation sidebar:
|
||||
|
||||

|
||||
|
||||
Enter the name of the job, choose the **Pipeline** option, and click OK.
|
||||
|
||||

|
||||
|
||||
Scroll down to the **Pipeline** section, paste the following into the **Script** field, and click **Save**.
|
||||
|
||||
```
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
INFISICAL_SERVICE_TOKEN = credentials('INFISICAL_SERVICE_TOKEN')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Run Infisical') {
|
||||
steps {
|
||||
sh("infisical secrets")
|
||||
|
||||
// doesn't work
|
||||
// sh("docker run --rm test-container infisical secrets")
|
||||
|
||||
// works
|
||||
// sh("docker run -e INFISICAL_SERVICE_TOKEN=${INFISICAL_SERVICE_TOKEN} --rm test-container infisical secrets")
|
||||
|
||||
// doesn't work
|
||||
// sh("docker-compose up -d")
|
||||
|
||||
// works
|
||||
// sh("INFISICAL_SERVICE_TOKEN=${INFISICAL_SERVICE_TOKEN} docker-compose up -d")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This is a very basic sample that you can work from. Jenkins injects the INFISICAL_SERVICE_TOKEN environment variable defined in the pipeline into the shell the commands execute with, but there are some situations where that won't pass through properly – notably if you're executing docker containers on the executor machine. The examples above should give you some idea for how that will work.
|
||||
|
||||
Finally, click **Build Now** from the navigation sidebar to test your new job.
|
||||
6
docs/integrations/platforms/ansible.mdx
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: "PM2"
|
||||
description: "How to use Infisical for secret management in Ansible"
|
||||
---
|
||||
|
||||
The documentation for using Infisical to manage secrets in Ansible is currently available [here](https://galaxy.ansible.com/ui/repo/published/infisical/vault/).
|
||||