mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 22:27:22 +00:00
Make sync function for Codefresh
This commit is contained in:
@@ -225,7 +225,6 @@ const syncSecrets = async ({
|
|||||||
case INTEGRATION_CODEFRESH:
|
case INTEGRATION_CODEFRESH:
|
||||||
await syncSecretsCodefresh({
|
await syncSecretsCodefresh({
|
||||||
integration,
|
integration,
|
||||||
// integrationAuth,
|
|
||||||
secrets,
|
secrets,
|
||||||
accessToken,
|
accessToken,
|
||||||
});
|
});
|
||||||
@@ -1923,17 +1922,13 @@ const syncSecretsCloudflarePages = async ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sync/push [secrets] to codefresh with name [integration.app]
|
* Sync/push [secrets] to Codefresh with name [integration.app]
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
* @param {IIntegration} obj.integration - integration details
|
* @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 {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 Supabase integration
|
* @param {String} obj.accessToken - access token for Codefresh integration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const syncSecretsCodefresh = async ({
|
const syncSecretsCodefresh = async ({
|
||||||
integration,
|
integration,
|
||||||
secrets,
|
secrets,
|
||||||
@@ -1943,89 +1938,21 @@ const syncSecretsCodefresh = async ({
|
|||||||
secrets: any;
|
secrets: any;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
}) => {
|
}) => {
|
||||||
// get variables from codefresh.
|
await standardRequest.patch(
|
||||||
|
`${INTEGRATION_CODEFRESH_API_URL}/projects/${integration.appId}`,
|
||||||
// there is no endpoint to get secrets from codefresh
|
{
|
||||||
// const getSecretsRes = (
|
variables: Object.keys(secrets).map((key) => ({
|
||||||
// await standardRequest.get(
|
key,
|
||||||
// `${INTEGRATION_CODEFRESH_API_URL}/api/pipelines/utils/extractVariables`,
|
value: secrets[key]
|
||||||
// {
|
}))
|
||||||
// headers: {
|
},
|
||||||
// "Authorization": `Bearer ${accessToken}`,
|
{
|
||||||
// "Accept-Encoding": "application/json",
|
headers: {
|
||||||
// },
|
Authorization: `Bearer ${accessToken}`,
|
||||||
// }
|
"Accept": "application/json",
|
||||||
// )
|
},
|
||||||
// )
|
}
|
||||||
// .data
|
);
|
||||||
// .reduce((obj: any, secret: any) => ({
|
|
||||||
// ...obj,
|
|
||||||
// [secret.key]: secret.value,
|
|
||||||
// }), {});
|
|
||||||
|
|
||||||
// add secrets
|
|
||||||
// for await (const key of Object.keys(secrets)) {
|
|
||||||
// if (!(key in getSecretsRes)) {
|
|
||||||
// // case: secret does not exist in codefresh
|
|
||||||
// // -> add secret
|
|
||||||
|
|
||||||
// await standardRequest.post(
|
|
||||||
// `${INTEGRATION_CODEFRESH_API_URL}/api/pipelines`,
|
|
||||||
// {
|
|
||||||
// spec: {
|
|
||||||
// variables: [
|
|
||||||
// {
|
|
||||||
// key,
|
|
||||||
// value: secrets[key],
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// "Authorization": `Bearer ${accessToken}`,
|
|
||||||
// "Accept": "application/json",
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// // case: secret exists in checkly
|
|
||||||
// // -> update/set secret
|
|
||||||
|
|
||||||
// if (secrets[key] !== getSecretsRes[key]) {
|
|
||||||
// await standardRequest.put(
|
|
||||||
// `${INTEGRATION_CODEFRESH_API_URL}/v1/variables/${key}`,
|
|
||||||
// {
|
|
||||||
// value: secrets[key],
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// "Authorization": `Bearer ${accessToken}`,
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// "Accept": "application/json",
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for await (const key of Object.keys(getSecretsRes)) {
|
|
||||||
// if (!(key in secrets)) {
|
|
||||||
// // delete secret
|
|
||||||
// await standardRequest.delete(
|
|
||||||
// `${INTEGRATION_CODEFRESH_API_URL}/v1/variables/${key}`,
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// "Authorization": `Bearer ${accessToken}`,
|
|
||||||
// "Accept": "application/json",
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export { syncSecrets };
|
export { syncSecrets };
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ export const INTEGRATION_SUPABASE = 'supabase';
|
|||||||
export const INTEGRATION_CHECKLY = 'checkly';
|
export const INTEGRATION_CHECKLY = 'checkly';
|
||||||
export const INTEGRATION_HASHICORP_VAULT = 'hashicorp-vault';
|
export const INTEGRATION_HASHICORP_VAULT = 'hashicorp-vault';
|
||||||
export const INTEGRATION_CLOUDFLARE_PAGES = 'cloudflare-pages';
|
export const INTEGRATION_CLOUDFLARE_PAGES = 'cloudflare-pages';
|
||||||
// chisom
|
|
||||||
export const INTEGRATION_CODEFRESH = 'codefresh';
|
export const INTEGRATION_CODEFRESH = 'codefresh';
|
||||||
|
|
||||||
export const INTEGRATION_SET = new Set([
|
export const INTEGRATION_SET = new Set([
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ export default function CodefreshCreateIntegrationPage() {
|
|||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await saveIntegrationAccessToken({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "codefresh",
|
integration: "codefresh",
|
||||||
accessToken: apiKey,
|
|
||||||
accessId: null,
|
accessId: null,
|
||||||
|
accessToken: apiKey,
|
||||||
url: null,
|
url: null,
|
||||||
namespace: null
|
namespace: null
|
||||||
});
|
});
|
||||||
|
|||||||
-2
@@ -32,8 +32,6 @@ export const IntegrationsSection = ({
|
|||||||
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
|
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
|
||||||
"deleteConfirmation"
|
"deleteConfirmation"
|
||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
console.log(integrationSlugNameMapping, integrations, '>>>chisom')
|
|
||||||
return (
|
return (
|
||||||
<div className="mb-8">
|
<div className="mb-8">
|
||||||
<div className="mx-4 mb-4 mt-6 flex flex-col items-start justify-between px-2 text-xl">
|
<div className="mx-4 mb-4 mt-6 flex flex-col items-start justify-between px-2 text-xl">
|
||||||
|
|||||||
Reference in New Issue
Block a user