diff --git a/backend/src/integrations/apps.ts b/backend/src/integrations/apps.ts index 199d8c121..4598ab213 100644 --- a/backend/src/integrations/apps.ts +++ b/backend/src/integrations/apps.ts @@ -36,7 +36,6 @@ import { INTEGRATION_SUPABASE, INTEGRATION_SUPABASE_API_URL, INTEGRATION_TEAMCITY, - INTEGRATION_TEAMCITY_API_URL, INTEGRATION_TERRAFORM_CLOUD, INTEGRATION_TERRAFORM_CLOUD_API_URL, INTEGRATION_TRAVISCI, @@ -155,6 +154,7 @@ const getApps = async ({ break; case INTEGRATION_TEAMCITY: apps = await getAppsTeamCity({ + integrationAuth, accessToken, }); break; @@ -737,12 +737,14 @@ const getAppsGitlab = async ({ * @returns {String} apps.name - name of TeamCity projects */ const getAppsTeamCity = async ({ + integrationAuth, accessToken, }: { + integrationAuth: IIntegrationAuth; accessToken: string; }) => { const res = ( - await standardRequest.get(`${INTEGRATION_TEAMCITY_API_URL}/app/rest/projects`, { + await standardRequest.get(`${integrationAuth.url}/app/rest/projects`, { headers: { Authorization: `Bearer ${accessToken}`, Accept: "application/json", diff --git a/backend/src/integrations/sync.ts b/backend/src/integrations/sync.ts index a719f6397..19e48ac6c 100644 --- a/backend/src/integrations/sync.ts +++ b/backend/src/integrations/sync.ts @@ -45,7 +45,6 @@ import { INTEGRATION_SUPABASE, INTEGRATION_SUPABASE_API_URL, INTEGRATION_TEAMCITY, - INTEGRATION_TEAMCITY_API_URL, INTEGRATION_TERRAFORM_CLOUD, INTEGRATION_TERRAFORM_CLOUD_API_URL, INTEGRATION_TRAVISCI, @@ -237,6 +236,7 @@ const syncSecrets = async ({ break; case INTEGRATION_TEAMCITY: await syncSecretsTeamCity({ + integrationAuth, integration, secrets, accessToken, @@ -1988,10 +1988,12 @@ const syncSecretsTerraformCloud = async ({ * @param {String} obj.accessToken - access token for TeamCity integration */ const syncSecretsTeamCity = async ({ + integrationAuth, integration, secrets, accessToken, }: { + integrationAuth: IIntegrationAuth; integration: IIntegration; secrets: any; accessToken: string; @@ -1999,7 +2001,7 @@ const syncSecretsTeamCity = async ({ // get projects from TeamCity const res = ( - await standardRequest.get(`${INTEGRATION_TEAMCITY_API_URL}/app/rest/projects`, { + await standardRequest.get(`${integrationAuth.url}/app/rest/projects`, { headers: { Authorization: `Bearer ${accessToken}`, Accept: "application/json", @@ -2010,7 +2012,7 @@ const syncSecretsTeamCity = async ({ // get secrets from Teamcity const getParametersRes = ( await standardRequest.get( - `${INTEGRATION_TEAMCITY_API_URL}/app/rest/projects/id:${integration.appId}/parameters`, + `${integrationAuth.url}/app/rest/projects/id:${integration.appId}/parameters`, { headers: { Authorization: `Bearer ${accessToken}`, @@ -2022,7 +2024,7 @@ const syncSecretsTeamCity = async ({ for await (const key of Object.keys(secrets)) { if (key in res) { await standardRequest.put( - `${INTEGRATION_TEAMCITY_API_URL}/app/rest/projects/id:${integration.appId}/parameters/${res.id}`, + `${integrationAuth.url}/app/rest/projects/id:${integration.appId}/parameters/${res.id}`, { name: `env.${key}`, value: secrets[key] @@ -2036,7 +2038,7 @@ const syncSecretsTeamCity = async ({ ); } else { await standardRequest.post( - `${INTEGRATION_TEAMCITY_API_URL}/app/rest/projects/id:${integration.appId}/parameters`, + `${integrationAuth.url}/app/rest/projects/id:${integration.appId}/parameters`, { name: `env.${key}`, value: secrets[key] @@ -2057,7 +2059,7 @@ const syncSecretsTeamCity = async ({ if (!(modifiedString in secrets)) { await standardRequest.delete( - `${INTEGRATION_TEAMCITY_API_URL}/app/rest/projects/id:${integration.appId}/parameters/${sec.name}`, + `${integrationAuth.url}/app/rest/projects/id:${integration.appId}/parameters/${sec.name}`, { headers: { Authorization: `Bearer ${accessToken}`, diff --git a/backend/src/variables/integration.ts b/backend/src/variables/integration.ts index 81bb84468..b08d2a990 100644 --- a/backend/src/variables/integration.ts +++ b/backend/src/variables/integration.ts @@ -89,7 +89,6 @@ export const INTEGRATION_SUPABASE_API_URL = "https://api.supabase.com"; export const INTEGRATION_LARAVELFORGE_API_URL = "https://forge.laravel.com"; export const INTEGRATION_CHECKLY_API_URL = "https://api.checklyhq.com"; export const INTEGRATION_TERRAFORM_CLOUD_API_URL = "https://app.terraform.io"; -export const INTEGRATION_TEAMCITY_API_URL = "https://devaandrew.teamcity.com"; // URL needs to be changed export const INTEGRATION_CLOUDFLARE_PAGES_API_URL = "https://api.cloudflare.com"; export const INTEGRATION_BITBUCKET_API_URL = "https://api.bitbucket.org"; export const INTEGRATION_CODEFRESH_API_URL = "https://g.codefresh.io/api"; diff --git a/docs/images/integrations-terraformcloud-create.png b/docs/images/integrations-terraformcloud-create.png index 7c0ee12ee..0861ee36f 100644 Binary files a/docs/images/integrations-terraformcloud-create.png and b/docs/images/integrations-terraformcloud-create.png differ diff --git a/docs/integrations/overview.mdx b/docs/integrations/overview.mdx index 067f7e039..d97280361 100644 --- a/docs/integrations/overview.mdx +++ b/docs/integrations/overview.mdx @@ -21,6 +21,7 @@ Missing an integration? [Throw in a request](https://github.com/Infisical/infisi | [Laravel Forge](/integrations/cloud/laravel-forge) | Cloud | Available | | [Railway](/integrations/cloud/railway) | Cloud | Available | | [Terraform Cloud](/integrations/cloud/terraform-cloud) | Cloud | Available | +| [TeamCity](/integrations/cloud/teamcity) | Cloud | Available | | [Fly.io](/integrations/cloud/flyio) | Cloud | Available | | [Supabase](/integrations/cloud/supabase) | Cloud | Available | | [Northflank](/integrations/cloud/northflank) | Cloud | Available | diff --git a/frontend/src/pages/integrations/teamcity/authorize.tsx b/frontend/src/pages/integrations/teamcity/authorize.tsx index 02b25680f..59070013a 100644 --- a/frontend/src/pages/integrations/teamcity/authorize.tsx +++ b/frontend/src/pages/integrations/teamcity/authorize.tsx @@ -8,17 +8,25 @@ export default function TeamCityCreateIntegrationPage() { const router = useRouter(); const [apiKey, setApiKey] = useState(""); const [apiKeyErrorText, setApiKeyErrorText] = useState(""); + const [serverUrl, setServerUrl] = useState(""); + const [serverUrlErrorText, setServerUrlErrorText] = useState(""); const [isLoading, setIsLoading] = useState(false); const handleButtonClick = async () => { try { setApiKeyErrorText(""); + setServerUrlErrorText(""); if (apiKey.length === 0) { setApiKeyErrorText("API Token cannot be blank"); return; } + if (serverUrl.length === 0) { + setServerUrlErrorText("Server URL cannot be blank"); + return; + } + setIsLoading(true); const integrationAuth = await saveIntegrationAccessToken({ @@ -26,7 +34,7 @@ export default function TeamCityCreateIntegrationPage() { integration: "teamcity", accessId: null, accessToken: apiKey, - url: null, + url: serverUrl, namespace: null }); @@ -47,7 +55,22 @@ export default function TeamCityCreateIntegrationPage() { errorText={apiKeyErrorText} isError={apiKeyErrorText !== "" ?? false} > - setApiKey(e.target.value)} /> + setApiKey(e.target.value)} + /> + + + setServerUrl(e.target.value)} + />