mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
TeamCity integration
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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}`,
|
||||
|
||||
@@ -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";
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 228 KiB |
@@ -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 |
|
||||
|
||||
@@ -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}
|
||||
>
|
||||
<Input placeholder="API Token" value={apiKey} onChange={(e) => setApiKey(e.target.value)} />
|
||||
<Input
|
||||
placeholder="API Token"
|
||||
value={apiKey}
|
||||
onChange={(e) => setApiKey(e.target.value)}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormControl
|
||||
label="TeamCity Server URL"
|
||||
errorText={serverUrlErrorText}
|
||||
isError={serverUrlErrorText !== "" ?? false}
|
||||
>
|
||||
<Input
|
||||
placeholder="https://example.teamcity.com"
|
||||
value={serverUrl}
|
||||
onChange={(e) => setServerUrl(e.target.value)}
|
||||
/>
|
||||
</FormControl>
|
||||
<Button
|
||||
onClick={handleButtonClick}
|
||||
|
||||
Reference in New Issue
Block a user