mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
@@ -375,7 +375,7 @@ const getAppsTravisCI = async ({ accessToken }: { accessToken: string }) => {
|
||||
let apps: any;
|
||||
try {
|
||||
const res = (
|
||||
await axios.get(
|
||||
await request.get(
|
||||
`${INTEGRATION_TRAVISCI_API_URL}/repos`,
|
||||
{
|
||||
headers: {
|
||||
|
||||
@@ -1344,7 +1344,7 @@ const syncSecretsTravisCI = async ({
|
||||
try {
|
||||
// get secrets from travis-ci
|
||||
const getSecretsRes = (
|
||||
await axios.get(
|
||||
await request.get(
|
||||
`${INTEGRATION_TRAVISCI_API_URL}/settings/env_vars?repository_id=${integration.appId}`,
|
||||
{
|
||||
headers: {
|
||||
@@ -1353,18 +1353,25 @@ const syncSecretsTravisCI = async ({
|
||||
},
|
||||
}
|
||||
)
|
||||
).data?.env_vars;
|
||||
|
||||
)
|
||||
.data
|
||||
?.env_vars
|
||||
.reduce((obj: any, secret: any) => ({
|
||||
...obj,
|
||||
[secret.name]: secret
|
||||
}), {});
|
||||
|
||||
// add secrets
|
||||
for (const key of Object.keys(secrets)) {
|
||||
const existingSecret = getSecretsRes.find((s: any) => s.name == key);
|
||||
if(!existingSecret){
|
||||
await axios.post(
|
||||
for await (const key of Object.keys(secrets)) {
|
||||
if (!(key in getSecretsRes)) {
|
||||
// case: secret does not exist in travis ci
|
||||
// -> add secret
|
||||
await request.post(
|
||||
`${INTEGRATION_TRAVISCI_API_URL}/settings/env_vars?repository_id=${integration.appId}`,
|
||||
{
|
||||
env_var: {
|
||||
name: key,
|
||||
value: secrets[key],
|
||||
value: secrets[key]
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1374,10 +1381,12 @@ const syncSecretsTravisCI = async ({
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
}else { // update secret
|
||||
await axios.patch(
|
||||
`${INTEGRATION_TRAVISCI_API_URL}/settings/env_vars/${existingSecret.id}?repository_id=${existingSecret.repository_id}`,
|
||||
);
|
||||
} else {
|
||||
// case: secret exists in travis ci
|
||||
// -> update/set secret
|
||||
await request.patch(
|
||||
`${INTEGRATION_TRAVISCI_API_URL}/settings/env_vars/${getSecretsRes[key].id}?repository_id=${getSecretsRes[key].repository_id}`,
|
||||
{
|
||||
env_var: {
|
||||
name: key,
|
||||
@@ -1391,29 +1400,29 @@ const syncSecretsTravisCI = async ({
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// delete secret
|
||||
for (const sec of getSecretsRes) {
|
||||
if (!(sec.name in secrets)){
|
||||
await axios.delete(
|
||||
`${INTEGRATION_TRAVISCI_API_URL}/settings/env_vars/${sec.id}?repository_id=${sec.repository_id}`,
|
||||
{
|
||||
headers: {
|
||||
"Authorization": `token ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}catch (err) {
|
||||
|
||||
for await (const key of Object.keys(getSecretsRes)) {
|
||||
if (!(key in secrets)){
|
||||
// delete secret
|
||||
await request.delete(
|
||||
`${INTEGRATION_TRAVISCI_API_URL}/settings/env_vars/${getSecretsRes[key].id}?repository_id=${getSecretsRes[key].repository_id}`,
|
||||
{
|
||||
headers: {
|
||||
"Authorization": `token ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
"Accept-Encoding": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
Sentry.setUser(null);
|
||||
Sentry.captureException(err);
|
||||
throw new Error("Failed to sync secrets to CircleCI");
|
||||
throw new Error("Failed to sync secrets to TravisCI");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,15 @@ const INTEGRATION_OPTIONS = [
|
||||
clientId: '',
|
||||
docsLink: ''
|
||||
},
|
||||
{
|
||||
name: 'Travis CI',
|
||||
slug: 'travisci',
|
||||
image: 'Travis CI.png',
|
||||
isAvailable: true,
|
||||
type: 'pat',
|
||||
clientId: '',
|
||||
docsLink: ''
|
||||
},
|
||||
{
|
||||
name: 'Azure Key Vault',
|
||||
slug: 'azure-key-vault',
|
||||
@@ -155,15 +164,6 @@ const INTEGRATION_OPTIONS = [
|
||||
type: '',
|
||||
clientId: '',
|
||||
docsLink: ''
|
||||
},
|
||||
{
|
||||
name: 'Travis CI',
|
||||
slug: 'travisci',
|
||||
image: 'Travis CI.png',
|
||||
isAvailable: true,
|
||||
type: 'pat',
|
||||
clientId: '',
|
||||
docsLink: ''
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
BIN
docs/images/integrations-travisci-auth.png
Normal file
BIN
docs/images/integrations-travisci-auth.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 166 KiB |
BIN
docs/images/integrations-travisci-create.png
Normal file
BIN
docs/images/integrations-travisci-create.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 184 KiB |
BIN
docs/images/integrations-travisci-token.png
Normal file
BIN
docs/images/integrations-travisci-token.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 292 KiB |
BIN
docs/images/integrations-travisci.png
Normal file
BIN
docs/images/integrations-travisci.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 370 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 385 KiB After Width: | Height: | Size: 424 KiB |
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "Circle CI"
|
||||
title: "CircleCI"
|
||||
description: "How to automatically sync secrets from Infisical into your CircleCI project."
|
||||
---
|
||||
|
||||
@@ -32,5 +32,5 @@ Press on the CircleCI tile and input your CircleCI API token to grant Infisical
|
||||
|
||||
Select which Infisical environment secrets you want to sync to which CircleCI project and press create integration to start syncing secrets to CircleCI.
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
36
docs/integrations/cicd/travisci.mdx
Normal file
36
docs/integrations/cicd/travisci.mdx
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
title: "Travis CI"
|
||||
description: "How to automatically sync secrets from Infisical to your Travis CI repository."
|
||||
---
|
||||
|
||||
Prerequisites:
|
||||
|
||||
- Set up and add envars to [Infisical Cloud](https://app.infisical.com)
|
||||
|
||||
## Navigate to your project's integrations tab
|
||||
|
||||

|
||||
|
||||
## Authorize Infisical for Travis CI
|
||||
|
||||
Obtain your API token in User Settings > API authentication > Token
|
||||
|
||||

|
||||
|
||||
Press on the Travis CI tile and input your Travis CI API token to grant Infisical access to your Travis CI account.
|
||||
|
||||

|
||||
|
||||
<Info>
|
||||
If this is your project's first cloud integration, then you'll have to grant
|
||||
Infisical access to your project's environment variables. Although this step
|
||||
breaks E2EE, it's necessary for Infisical to sync the environment variables to
|
||||
the cloud platform.
|
||||
</Info>
|
||||
|
||||
## Start integration
|
||||
|
||||
Select which Infisical environment secrets you want to sync to which Travis CI repository and press create integration to start syncing secrets to Travis CI.
|
||||
|
||||

|
||||

|
||||
@@ -23,6 +23,7 @@ Missing an integration? Throw in a [request](https://github.com/Infisical/infisi
|
||||
| [GitHub Actions](/integrations/cicd/githubactions) | CI/CD | Available |
|
||||
| [GitLab Pipeline](/integrations/cicd/gitlab) | CI/CD | Available |
|
||||
| [CircleCI](/integrations/cicd/circleci) | CI/CD | Available |
|
||||
| [Travis CI](/integrations/cicd/travisci) | CI/CD | Available |
|
||||
| [React](/integrations/frameworks/react) | Framework | Available |
|
||||
| [Vue](/integrations/frameworks/vue) | Framework | Available |
|
||||
| [Express](/integrations/frameworks/express) | Framework | Available |
|
||||
@@ -41,6 +42,5 @@ Missing an integration? Throw in a [request](https://github.com/Infisical/infisi
|
||||
| GCP | Cloud | Coming soon |
|
||||
| Azure | Cloud | Coming soon |
|
||||
| DigitalOcean | Cloud | Coming soon |
|
||||
| TravisCI | CI/CD | Coming soon |
|
||||
| GitHub Actions | CI/CD | Coming soon |
|
||||
| Jenkins | CI/CD | Coming soon |
|
||||
|
||||
@@ -233,7 +233,8 @@
|
||||
"pages": [
|
||||
"integrations/cicd/githubactions",
|
||||
"integrations/cicd/gitlab",
|
||||
"integrations/cicd/circleci"
|
||||
"integrations/cicd/circleci",
|
||||
"integrations/cicd/travisci"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -47,9 +47,9 @@ export default function TravisCICreateIntegrationPage() {
|
||||
return (
|
||||
<div className="h-full w-full flex justify-center items-center">
|
||||
<Card className="max-w-md p-8 rounded-md">
|
||||
<CardTitle className='text-center'>TravisCI Integration</CardTitle>
|
||||
<CardTitle className='text-center'>Travis CI Integration</CardTitle>
|
||||
<FormControl
|
||||
label="Travis API Token"
|
||||
label="Travis CI API Token"
|
||||
errorText={apiKeyErrorText}
|
||||
isError={apiKeyErrorText !== '' ?? false}
|
||||
>
|
||||
@@ -65,7 +65,7 @@ export default function TravisCICreateIntegrationPage() {
|
||||
className='mt-4'
|
||||
isLoading={isLoading}
|
||||
>
|
||||
Connect to TravisCI
|
||||
Connect to Travis CI
|
||||
</Button>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
@@ -73,7 +73,7 @@ export default function TravisCICreateIntegrationPage() {
|
||||
return (integrationAuth && workspace && selectedSourceEnvironment && integrationAuthApps && targetApp) ? (
|
||||
<div className="h-full w-full flex justify-center items-center">
|
||||
<Card className="max-w-md p-8 rounded-md">
|
||||
<CardTitle className='text-center'>TravisCI Integration</CardTitle>
|
||||
<CardTitle className='text-center'>Travis CI Integration</CardTitle>
|
||||
<FormControl
|
||||
label="Project Environment"
|
||||
className='mt-4'
|
||||
@@ -91,7 +91,7 @@ export default function TravisCICreateIntegrationPage() {
|
||||
</Select>
|
||||
</FormControl>
|
||||
<FormControl
|
||||
label="TravisCI Project"
|
||||
label="Travis CI Project"
|
||||
className='mt-4'
|
||||
>
|
||||
<Select
|
||||
|
||||
Reference in New Issue
Block a user