mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 10:28:00 +00:00
TeamCity integration
This commit is contained in:
@@ -36,7 +36,6 @@ import {
|
|||||||
INTEGRATION_SUPABASE,
|
INTEGRATION_SUPABASE,
|
||||||
INTEGRATION_SUPABASE_API_URL,
|
INTEGRATION_SUPABASE_API_URL,
|
||||||
INTEGRATION_TEAMCITY,
|
INTEGRATION_TEAMCITY,
|
||||||
INTEGRATION_TEAMCITY_API_URL,
|
|
||||||
INTEGRATION_TERRAFORM_CLOUD,
|
INTEGRATION_TERRAFORM_CLOUD,
|
||||||
INTEGRATION_TERRAFORM_CLOUD_API_URL,
|
INTEGRATION_TERRAFORM_CLOUD_API_URL,
|
||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
@@ -155,6 +154,7 @@ const getApps = async ({
|
|||||||
break;
|
break;
|
||||||
case INTEGRATION_TEAMCITY:
|
case INTEGRATION_TEAMCITY:
|
||||||
apps = await getAppsTeamCity({
|
apps = await getAppsTeamCity({
|
||||||
|
integrationAuth,
|
||||||
accessToken,
|
accessToken,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@@ -737,12 +737,14 @@ const getAppsGitlab = async ({
|
|||||||
* @returns {String} apps.name - name of TeamCity projects
|
* @returns {String} apps.name - name of TeamCity projects
|
||||||
*/
|
*/
|
||||||
const getAppsTeamCity = async ({
|
const getAppsTeamCity = async ({
|
||||||
|
integrationAuth,
|
||||||
accessToken,
|
accessToken,
|
||||||
}: {
|
}: {
|
||||||
|
integrationAuth: IIntegrationAuth;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
}) => {
|
}) => {
|
||||||
const res = (
|
const res = (
|
||||||
await standardRequest.get(`${INTEGRATION_TEAMCITY_API_URL}/app/rest/projects`, {
|
await standardRequest.get(`${integrationAuth.url}/app/rest/projects`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import {
|
|||||||
INTEGRATION_SUPABASE,
|
INTEGRATION_SUPABASE,
|
||||||
INTEGRATION_SUPABASE_API_URL,
|
INTEGRATION_SUPABASE_API_URL,
|
||||||
INTEGRATION_TEAMCITY,
|
INTEGRATION_TEAMCITY,
|
||||||
INTEGRATION_TEAMCITY_API_URL,
|
|
||||||
INTEGRATION_TERRAFORM_CLOUD,
|
INTEGRATION_TERRAFORM_CLOUD,
|
||||||
INTEGRATION_TERRAFORM_CLOUD_API_URL,
|
INTEGRATION_TERRAFORM_CLOUD_API_URL,
|
||||||
INTEGRATION_TRAVISCI,
|
INTEGRATION_TRAVISCI,
|
||||||
@@ -237,6 +236,7 @@ const syncSecrets = async ({
|
|||||||
break;
|
break;
|
||||||
case INTEGRATION_TEAMCITY:
|
case INTEGRATION_TEAMCITY:
|
||||||
await syncSecretsTeamCity({
|
await syncSecretsTeamCity({
|
||||||
|
integrationAuth,
|
||||||
integration,
|
integration,
|
||||||
secrets,
|
secrets,
|
||||||
accessToken,
|
accessToken,
|
||||||
@@ -1988,10 +1988,12 @@ const syncSecretsTerraformCloud = async ({
|
|||||||
* @param {String} obj.accessToken - access token for TeamCity integration
|
* @param {String} obj.accessToken - access token for TeamCity integration
|
||||||
*/
|
*/
|
||||||
const syncSecretsTeamCity = async ({
|
const syncSecretsTeamCity = async ({
|
||||||
|
integrationAuth,
|
||||||
integration,
|
integration,
|
||||||
secrets,
|
secrets,
|
||||||
accessToken,
|
accessToken,
|
||||||
}: {
|
}: {
|
||||||
|
integrationAuth: IIntegrationAuth;
|
||||||
integration: IIntegration;
|
integration: IIntegration;
|
||||||
secrets: any;
|
secrets: any;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
@@ -1999,7 +2001,7 @@ const syncSecretsTeamCity = async ({
|
|||||||
|
|
||||||
// get projects from TeamCity
|
// get projects from TeamCity
|
||||||
const res = (
|
const res = (
|
||||||
await standardRequest.get(`${INTEGRATION_TEAMCITY_API_URL}/app/rest/projects`, {
|
await standardRequest.get(`${integrationAuth.url}/app/rest/projects`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
@@ -2010,7 +2012,7 @@ const syncSecretsTeamCity = async ({
|
|||||||
// get secrets from Teamcity
|
// get secrets from Teamcity
|
||||||
const getParametersRes = (
|
const getParametersRes = (
|
||||||
await standardRequest.get(
|
await standardRequest.get(
|
||||||
`${INTEGRATION_TEAMCITY_API_URL}/app/rest/projects/id:${integration.appId}/parameters`,
|
`${integrationAuth.url}/app/rest/projects/id:${integration.appId}/parameters`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
@@ -2022,7 +2024,7 @@ const syncSecretsTeamCity = async ({
|
|||||||
for await (const key of Object.keys(secrets)) {
|
for await (const key of Object.keys(secrets)) {
|
||||||
if (key in res) {
|
if (key in res) {
|
||||||
await standardRequest.put(
|
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}`,
|
name: `env.${key}`,
|
||||||
value: secrets[key]
|
value: secrets[key]
|
||||||
@@ -2036,7 +2038,7 @@ const syncSecretsTeamCity = async ({
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await standardRequest.post(
|
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}`,
|
name: `env.${key}`,
|
||||||
value: secrets[key]
|
value: secrets[key]
|
||||||
@@ -2057,7 +2059,7 @@ const syncSecretsTeamCity = async ({
|
|||||||
|
|
||||||
if (!(modifiedString in secrets)) {
|
if (!(modifiedString in secrets)) {
|
||||||
await standardRequest.delete(
|
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: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
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_LARAVELFORGE_API_URL = "https://forge.laravel.com";
|
||||||
export const INTEGRATION_CHECKLY_API_URL = "https://api.checklyhq.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_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_CLOUDFLARE_PAGES_API_URL = "https://api.cloudflare.com";
|
||||||
export const INTEGRATION_BITBUCKET_API_URL = "https://api.bitbucket.org";
|
export const INTEGRATION_BITBUCKET_API_URL = "https://api.bitbucket.org";
|
||||||
export const INTEGRATION_CODEFRESH_API_URL = "https://g.codefresh.io/api";
|
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 |
|
| [Laravel Forge](/integrations/cloud/laravel-forge) | Cloud | Available |
|
||||||
| [Railway](/integrations/cloud/railway) | Cloud | Available |
|
| [Railway](/integrations/cloud/railway) | Cloud | Available |
|
||||||
| [Terraform Cloud](/integrations/cloud/terraform-cloud) | Cloud | Available |
|
| [Terraform Cloud](/integrations/cloud/terraform-cloud) | Cloud | Available |
|
||||||
|
| [TeamCity](/integrations/cloud/teamcity) | Cloud | Available |
|
||||||
| [Fly.io](/integrations/cloud/flyio) | Cloud | Available |
|
| [Fly.io](/integrations/cloud/flyio) | Cloud | Available |
|
||||||
| [Supabase](/integrations/cloud/supabase) | Cloud | Available |
|
| [Supabase](/integrations/cloud/supabase) | Cloud | Available |
|
||||||
| [Northflank](/integrations/cloud/northflank) | Cloud | Available |
|
| [Northflank](/integrations/cloud/northflank) | Cloud | Available |
|
||||||
|
|||||||
@@ -8,17 +8,25 @@ export default function TeamCityCreateIntegrationPage() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
|
const [serverUrl, setServerUrl] = useState("");
|
||||||
|
const [serverUrlErrorText, setServerUrlErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const handleButtonClick = async () => {
|
const handleButtonClick = async () => {
|
||||||
try {
|
try {
|
||||||
setApiKeyErrorText("");
|
setApiKeyErrorText("");
|
||||||
|
setServerUrlErrorText("");
|
||||||
|
|
||||||
if (apiKey.length === 0) {
|
if (apiKey.length === 0) {
|
||||||
setApiKeyErrorText("API Token cannot be blank");
|
setApiKeyErrorText("API Token cannot be blank");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (serverUrl.length === 0) {
|
||||||
|
setServerUrlErrorText("Server URL cannot be blank");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const integrationAuth = await saveIntegrationAccessToken({
|
const integrationAuth = await saveIntegrationAccessToken({
|
||||||
@@ -26,7 +34,7 @@ export default function TeamCityCreateIntegrationPage() {
|
|||||||
integration: "teamcity",
|
integration: "teamcity",
|
||||||
accessId: null,
|
accessId: null,
|
||||||
accessToken: apiKey,
|
accessToken: apiKey,
|
||||||
url: null,
|
url: serverUrl,
|
||||||
namespace: null
|
namespace: null
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -47,7 +55,22 @@ export default function TeamCityCreateIntegrationPage() {
|
|||||||
errorText={apiKeyErrorText}
|
errorText={apiKeyErrorText}
|
||||||
isError={apiKeyErrorText !== "" ?? false}
|
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>
|
</FormControl>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleButtonClick}
|
onClick={handleButtonClick}
|
||||||
|
|||||||
Reference in New Issue
Block a user