From 445fa35ab5bbabd10f852470e89ddc0a66c5a6ba Mon Sep 17 00:00:00 2001 From: Tuan Dang Date: Mon, 13 Feb 2023 18:55:09 +0700 Subject: [PATCH] Add Aashish to README --- README.md | 5 ++--- backend/src/integrations/apps.ts | 21 +++++++++++-------- backend/src/integrations/sync.ts | 13 +++++++++--- backend/src/variables/integration.ts | 18 ++++++++-------- .../pages/integrations/circleci/authorize.tsx | 2 +- 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 64d643e7f..0331567ec 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,7 @@ Dashboard - -**Read this in other languages**: [English language](i18n/README.en.md) +**Read this in other languages**: [English language](i18n/README.en.md) [Spanish language](i18n/README.es.md) [Korean language](i18n/README.ko.md) [Turkish language](i18n/README.tr.md) @@ -358,7 +357,7 @@ Infisical officially launched as v.1.0 on November 21st, 2022. There are a lot o - + ## 🌎 Translations diff --git a/backend/src/integrations/apps.ts b/backend/src/integrations/apps.ts index 17dbb2be0..7a828f332 100644 --- a/backend/src/integrations/apps.ts +++ b/backend/src/integrations/apps.ts @@ -86,7 +86,7 @@ const getApps = async ({ }); break; case INTEGRATION_CIRCLECI: - apps = await getAppsCircleci({ + apps = await getAppsCircleCI({ accessToken, }); break; @@ -333,11 +333,17 @@ const getAppsFlyio = async ({ accessToken }: { accessToken: string }) => { return apps; }; -const getAppsCircleci = async ({ accessToken }: { accessToken: string }) => { - // in place of accessToken we have to send Circle-Token i.e. Personal API token from CircleCi +/** + * Return list of projects for CircleCI integration + * @param {Object} obj + * @param {String} obj.accessToken - access token for CircleCI API + * @returns {Object[]} apps - + * @returns {String} apps.name - name of CircleCI apps + */ +const getAppsCircleCI = async ({ accessToken }: { accessToken: string }) => { let apps: any; try { - let res = ( + const res = ( await axios.get( `${INTEGRATION_CIRCLECI_API_URL}/v1.1/projects`, { @@ -353,15 +359,12 @@ const getAppsCircleci = async ({ accessToken }: { accessToken: string }) => { return { name: a?.reponame } - }) + }); } catch (err) { - console.log(err); Sentry.setUser(null); Sentry.captureException(err); - throw new Error("Failed to get Render services"); + throw new Error("Failed to get CircleCI projects"); } - - console.log("hello apps"); return apps; }; diff --git a/backend/src/integrations/sync.ts b/backend/src/integrations/sync.ts index b78070e5a..e4bdc116c 100644 --- a/backend/src/integrations/sync.ts +++ b/backend/src/integrations/sync.ts @@ -124,7 +124,7 @@ const syncSecrets = async ({ }); break; case INTEGRATION_CIRCLECI: - await syncSecretsCircleci({ + await syncSecretsCircleCI({ integration, secrets, accessToken, @@ -1185,7 +1185,14 @@ const syncSecretsFlyio = async ({ } }; -const syncSecretsCircleci = async ({ +/** + * Sync/push [secrets] to CircleCI project + * @param {Object} obj + * @param {IIntegration} obj.integration - integration details + * @param {Object} obj.secrets - secrets to push to integration (object where keys are secret keys and values are secret values) + * @param {String} obj.accessToken - access token for CircleCI integration + */ +const syncSecretsCircleCI = async ({ integration, secrets, accessToken, @@ -1206,7 +1213,7 @@ const syncSecretsCircleci = async ({ const { slug } = circleciOrganizationDetail; - // inject secrets to CircleCI (one by one) + // sync secrets to CircleCI Object.keys(secrets).forEach( async (key) => await axios.post( diff --git a/backend/src/variables/integration.ts b/backend/src/variables/integration.ts index de7853ffa..3ef8d6f1e 100644 --- a/backend/src/variables/integration.ts +++ b/backend/src/variables/integration.ts @@ -125,6 +125,15 @@ const INTEGRATION_OPTIONS = [ clientId: '', docsLink: '' }, + { + name: 'Circle CI', + slug: 'circleci', + image: 'Circle CI.png', + isAvailable: true, + type: 'pat', + clientId: '', + docsLink: '' + }, { name: 'Azure Key Vault', slug: 'azure-key-vault', @@ -152,15 +161,6 @@ const INTEGRATION_OPTIONS = [ type: '', clientId: '', docsLink: '' - }, - { - name: 'Circle CI', - slug: 'circleci', - image: 'Circle CI.png', - isAvailable: true, - type: 'pat', - clientId: '', - docsLink: '' } ] diff --git a/frontend/src/pages/integrations/circleci/authorize.tsx b/frontend/src/pages/integrations/circleci/authorize.tsx index 109d525ea..7b9bd2b4e 100644 --- a/frontend/src/pages/integrations/circleci/authorize.tsx +++ b/frontend/src/pages/integrations/circleci/authorize.tsx @@ -54,7 +54,7 @@ export default function CircleCICreateIntegrationPage() { isError={apiKeyErrorText !== '' ?? false} > setApiKey(e.target.value)} />