update
This commit is contained in:
@@ -16,8 +16,8 @@
|
|||||||
"@api.global/typedrequest-interfaces": "^3.0.19",
|
"@api.global/typedrequest-interfaces": "^3.0.19",
|
||||||
"@api.global/typedserver": "8.4.0",
|
"@api.global/typedserver": "8.4.0",
|
||||||
"@api.global/typedsocket": "^4.1.0",
|
"@api.global/typedsocket": "^4.1.0",
|
||||||
"@apiclient.xyz/gitea": "1.4.0",
|
"@apiclient.xyz/gitea": "1.5.0",
|
||||||
"@apiclient.xyz/gitlab": "2.5.0",
|
"@apiclient.xyz/gitlab": "2.6.0",
|
||||||
"@design.estate/dees-catalog": "^3.43.3",
|
"@design.estate/dees-catalog": "^3.43.3",
|
||||||
"@design.estate/dees-element": "^2.1.6"
|
"@design.estate/dees-element": "^2.1.6"
|
||||||
},
|
},
|
||||||
|
|||||||
BIN
pipelines-current-mode.png
Normal file
BIN
pipelines-current-mode.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
@@ -230,7 +230,7 @@ export class ConnectionManager {
|
|||||||
try {
|
try {
|
||||||
if (conn.providerType === 'gitlab') {
|
if (conn.providerType === 'gitlab') {
|
||||||
const gitlabClient = new plugins.gitlabClient.GitLabClient(conn.baseUrl, conn.token);
|
const gitlabClient = new plugins.gitlabClient.GitLabClient(conn.baseUrl, conn.token);
|
||||||
const group = await gitlabClient.getGroupByPath(conn.groupFilter);
|
const group = await gitlabClient.getGroup(conn.groupFilter);
|
||||||
conn.groupFilterId = String(group.id);
|
conn.groupFilterId = String(group.id);
|
||||||
logger.info(`Resolved group filter "${conn.groupFilter}" to ID ${conn.groupFilterId}`);
|
logger.info(`Resolved group filter "${conn.groupFilter}" to ID ${conn.groupFilterId}`);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ export class SyncManager {
|
|||||||
for (const segment of groupSegments) {
|
for (const segment of groupSegments) {
|
||||||
currentPath = currentPath ? `${currentPath}/${segment}` : segment;
|
currentPath = currentPath ? `${currentPath}/${segment}` : segment;
|
||||||
try {
|
try {
|
||||||
const group = await client.getGroupByPath(currentPath);
|
const group = await client.getGroup(currentPath);
|
||||||
parentId = group.id;
|
parentId = group.id;
|
||||||
} catch {
|
} catch {
|
||||||
// Group doesn't exist — create it
|
// Group doesn't exist — create it
|
||||||
@@ -533,7 +533,7 @@ export class SyncManager {
|
|||||||
} catch (createErr: any) {
|
} catch (createErr: any) {
|
||||||
// 409 = already exists (race condition), try fetching again
|
// 409 = already exists (race condition), try fetching again
|
||||||
if (String(createErr).includes('409') || String(createErr).includes('already')) {
|
if (String(createErr).includes('409') || String(createErr).includes('already')) {
|
||||||
const group = await client.getGroupByPath(currentPath);
|
const group = await client.getGroup(currentPath);
|
||||||
parentId = group.id;
|
parentId = group.id;
|
||||||
} else {
|
} else {
|
||||||
throw createErr;
|
throw createErr;
|
||||||
@@ -558,7 +558,7 @@ export class SyncManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Check if project exists by path
|
// Check if project exists by path
|
||||||
await client.getGroupByPath(projectPath);
|
await client.getGroup(projectPath);
|
||||||
// If this succeeds, it's actually a group, not a project... unlikely but handle
|
// If this succeeds, it's actually a group, not a project... unlikely but handle
|
||||||
} catch {
|
} catch {
|
||||||
// Project doesn't exist as a group path; try creating it
|
// Project doesn't exist as a group path; try creating it
|
||||||
@@ -1107,7 +1107,7 @@ export class SyncManager {
|
|||||||
if (!targetProject) return;
|
if (!targetProject) return;
|
||||||
|
|
||||||
const client = new plugins.gitlabClient.GitLabClient(targetConn.baseUrl, targetConn.token);
|
const client = new plugins.gitlabClient.GitLabClient(targetConn.baseUrl, targetConn.token);
|
||||||
const protectedBranches = await client.getProtectedBranches(targetProject.id);
|
const protectedBranches = await client.requestGetProtectedBranches(targetProject.id);
|
||||||
if (protectedBranches.length === 0) return;
|
if (protectedBranches.length === 0) return;
|
||||||
|
|
||||||
// Get list of branches in the local mirror (= source branches)
|
// Get list of branches in the local mirror (= source branches)
|
||||||
@@ -1119,7 +1119,7 @@ export class SyncManager {
|
|||||||
for (const pb of protectedBranches) {
|
for (const pb of protectedBranches) {
|
||||||
if (!localBranches.has(pb.name)) {
|
if (!localBranches.has(pb.name)) {
|
||||||
logger.syncLog('info', `Unprotecting stale branch "${pb.name}" on ${targetFullPath}`, 'api');
|
logger.syncLog('info', `Unprotecting stale branch "${pb.name}" on ${targetFullPath}`, 'api');
|
||||||
await client.unprotectBranch(targetProject.id, pb.name);
|
await client.requestUnprotectBranch(targetProject.id, pb.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -1666,14 +1666,14 @@ export class SyncManager {
|
|||||||
// Walk the basePath to find the parent group, then create "obsolete" subgroup
|
// Walk the basePath to find the parent group, then create "obsolete" subgroup
|
||||||
let parentId: number | undefined;
|
let parentId: number | undefined;
|
||||||
if (basePath) {
|
if (basePath) {
|
||||||
const parentGroup = await client.getGroupByPath(basePath);
|
const parentGroup = await client.getGroup(basePath);
|
||||||
parentId = parentGroup.id;
|
parentId = parentGroup.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to get existing obsolete group
|
// Try to get existing obsolete group
|
||||||
const obsoletePath = basePath ? `${basePath}/obsolete` : 'obsolete';
|
const obsoletePath = basePath ? `${basePath}/obsolete` : 'obsolete';
|
||||||
try {
|
try {
|
||||||
const group = await client.getGroupByPath(obsoletePath);
|
const group = await client.getGroup(obsoletePath);
|
||||||
return { type: 'gitlab', groupId: group.id };
|
return { type: 'gitlab', groupId: group.id };
|
||||||
} catch {
|
} catch {
|
||||||
// Doesn't exist — create it
|
// Doesn't exist — create it
|
||||||
@@ -1684,7 +1684,7 @@ export class SyncManager {
|
|||||||
return { type: 'gitlab', groupId: newGroup.id };
|
return { type: 'gitlab', groupId: newGroup.id };
|
||||||
} catch (createErr: any) {
|
} catch (createErr: any) {
|
||||||
if (String(createErr).includes('409') || String(createErr).includes('already')) {
|
if (String(createErr).includes('409') || String(createErr).includes('already')) {
|
||||||
const group = await client.getGroupByPath(obsoletePath);
|
const group = await client.getGroup(obsoletePath);
|
||||||
return { type: 'gitlab', groupId: group.id };
|
return { type: 'gitlab', groupId: group.id };
|
||||||
}
|
}
|
||||||
throw createErr;
|
throw createErr;
|
||||||
|
|||||||
@@ -144,43 +144,27 @@ export class PipelinesHandler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Current mode: running/pending always shown, plus recent pipelines within timeRange.
|
* Current mode: running/pending always shown, plus recent pipelines within timeRange.
|
||||||
* Makes two parallel aggregation passes to ensure active pipelines are never missed:
|
* Fetches a generous page of recent pipelines per project (100), then splits into
|
||||||
* 1. Recent pipelines (no status filter) — for time-range display
|
* active (running/pending/waiting) and the rest. Active are always shown; the rest
|
||||||
* 2. Active pipelines (status: 'running') — guarantees we catch all running ones
|
* is filtered by timeRange.
|
||||||
*/
|
*/
|
||||||
private async fetchCurrentPipelines(
|
private async fetchCurrentPipelines(
|
||||||
provider: BaseProvider,
|
provider: BaseProvider,
|
||||||
timeRange: string,
|
timeRange: string,
|
||||||
): Promise<interfaces.data.IPipeline[]> {
|
): Promise<interfaces.data.IPipeline[]> {
|
||||||
const projects = await provider.getProjects();
|
const projects = await provider.getProjects();
|
||||||
|
const allPipelines = await this.fetchAggregatedPipelines(provider, projects, { perPage: 100 });
|
||||||
// Two parallel fetches: recent + explicitly active
|
|
||||||
const [recentPipelines, activePipelines] = await Promise.all([
|
|
||||||
this.fetchAggregatedPipelines(provider, projects, { perPage: 50 }),
|
|
||||||
this.fetchAggregatedPipelines(provider, projects, { status: 'running', perPage: 50 }),
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Merge and deduplicate (active first so they take precedence)
|
|
||||||
const seenIds = new Set<string>();
|
|
||||||
const merged: interfaces.data.IPipeline[] = [];
|
|
||||||
for (const p of [...activePipelines, ...recentPipelines]) {
|
|
||||||
const key = `${p.connectionId}:${p.projectId}:${p.id}`;
|
|
||||||
if (!seenIds.has(key)) {
|
|
||||||
seenIds.add(key);
|
|
||||||
merged.push(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Running/pending pipelines are always shown regardless of time
|
// Running/pending pipelines are always shown regardless of time
|
||||||
const active = merged.filter(
|
const active = allPipelines.filter(
|
||||||
(p) => p.status === 'running' || p.status === 'pending' || p.status === 'waiting',
|
(p) => p.status === 'running' || p.status === 'pending' || p.status === 'waiting',
|
||||||
);
|
);
|
||||||
const rest = merged.filter(
|
const rest = allPipelines.filter(
|
||||||
(p) => p.status !== 'running' && p.status !== 'pending' && p.status !== 'waiting',
|
(p) => p.status !== 'running' && p.status !== 'pending' && p.status !== 'waiting',
|
||||||
);
|
);
|
||||||
const filteredRest = this.filterByTimeRange(rest, timeRange);
|
const filteredRest = this.filterByTimeRange(rest, timeRange);
|
||||||
|
|
||||||
// Final dedup (active pipelines may also appear in filtered rest)
|
// Deduplicate (active pipelines may also appear in filtered rest)
|
||||||
const activeIds = new Set(active.map((p) => `${p.connectionId}:${p.projectId}:${p.id}`));
|
const activeIds = new Set(active.map((p) => `${p.connectionId}:${p.projectId}:${p.id}`));
|
||||||
const uniqueRest = filteredRest.filter(
|
const uniqueRest = filteredRest.filter(
|
||||||
(p) => !activeIds.has(`${p.connectionId}:${p.projectId}:${p.id}`),
|
(p) => !activeIds.has(`${p.connectionId}:${p.projectId}:${p.id}`),
|
||||||
|
|||||||
@@ -18,115 +18,46 @@ export class GiteaProvider extends BaseProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getProjects(opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
async getProjects(opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
||||||
// Use org-scoped listing when groupFilterId is set
|
const repos = this.groupFilterId
|
||||||
const fetchFn = this.groupFilterId
|
? await (await this.client.getOrg(this.groupFilterId)).getRepos(opts)
|
||||||
? (o: IListOptions) => this.client.getOrgRepos(this.groupFilterId!, o)
|
: await this.client.getRepos(opts);
|
||||||
: (o: IListOptions) => this.client.getRepos(o);
|
return repos.map((r) => this.mapProject(r));
|
||||||
|
|
||||||
// If caller explicitly requests a specific page, respect it (no auto-pagination)
|
|
||||||
if (opts?.page) {
|
|
||||||
const repos = await fetchFn(opts);
|
|
||||||
return repos.map((r) => this.mapProject(r));
|
|
||||||
}
|
|
||||||
|
|
||||||
const allRepos: plugins.giteaClient.IGiteaRepository[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
const repos = await fetchFn({ ...opts, page, perPage });
|
|
||||||
allRepos.push(...repos);
|
|
||||||
if (repos.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return allRepos.map((r) => this.mapProject(r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroups(opts?: IListOptions): Promise<interfaces.data.IGroup[]> {
|
async getGroups(opts?: IListOptions): Promise<interfaces.data.IGroup[]> {
|
||||||
// When groupFilterId is set, return only that single org
|
|
||||||
if (this.groupFilterId) {
|
if (this.groupFilterId) {
|
||||||
const org = await this.client.getOrg(this.groupFilterId);
|
const org = await this.client.getOrg(this.groupFilterId);
|
||||||
return [this.mapGroup(org)];
|
return [this.mapGroup(org)];
|
||||||
}
|
}
|
||||||
|
const orgs = await this.client.getOrgs(opts);
|
||||||
// If caller explicitly requests a specific page, respect it (no auto-pagination)
|
return orgs.map((o) => this.mapGroup(o));
|
||||||
if (opts?.page) {
|
|
||||||
const orgs = await this.client.getOrgs(opts);
|
|
||||||
return orgs.map((o) => this.mapGroup(o));
|
|
||||||
}
|
|
||||||
|
|
||||||
const allOrgs: plugins.giteaClient.IGiteaOrganization[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
const orgs = await this.client.getOrgs({ ...opts, page, perPage });
|
|
||||||
allOrgs.push(...orgs);
|
|
||||||
if (orgs.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return allOrgs.map((o) => this.mapGroup(o));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupProjects(groupId: string, opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
async getGroupProjects(groupId: string, opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
||||||
if (opts?.page) {
|
const org = await this.client.getOrg(groupId);
|
||||||
const repos = await this.client.getOrgRepos(groupId, opts);
|
const repos = await org.getRepos(opts);
|
||||||
return repos.map((r) => this.mapProject(r));
|
return repos.map((r) => this.mapProject(r));
|
||||||
}
|
|
||||||
const allRepos: plugins.giteaClient.IGiteaRepository[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
while (true) {
|
|
||||||
const repos = await this.client.getOrgRepos(groupId, { ...opts, page, perPage });
|
|
||||||
allRepos.push(...repos);
|
|
||||||
if (repos.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
return allRepos.map((r) => this.mapProject(r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Branches / Tags ---
|
// --- Branches / Tags ---
|
||||||
|
|
||||||
async getBranches(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.IBranch[]> {
|
async getBranches(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.IBranch[]> {
|
||||||
if (opts?.page) {
|
const repo = await this.client.getRepo(projectFullPath);
|
||||||
const branches = await this.client.getRepoBranches(projectFullPath, opts);
|
const branches = await repo.getBranches(opts);
|
||||||
return branches.map((b) => ({ name: b.name, commitSha: b.commit.id }));
|
return branches.map((b) => ({ name: b.name, commitSha: b.commitSha }));
|
||||||
}
|
|
||||||
const all: interfaces.data.IBranch[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
while (true) {
|
|
||||||
const branches = await this.client.getRepoBranches(projectFullPath, { ...opts, page, perPage });
|
|
||||||
all.push(...branches.map((b) => ({ name: b.name, commitSha: b.commit.id })));
|
|
||||||
if (branches.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
return all;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTags(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.ITag[]> {
|
async getTags(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.ITag[]> {
|
||||||
if (opts?.page) {
|
const repo = await this.client.getRepo(projectFullPath);
|
||||||
const tags = await this.client.getRepoTags(projectFullPath, opts);
|
const tags = await repo.getTags(opts);
|
||||||
return tags.map((t) => ({ name: t.name, commitSha: t.commit.sha }));
|
return tags.map((t) => ({ name: t.name, commitSha: t.commitSha }));
|
||||||
}
|
|
||||||
const all: interfaces.data.ITag[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
while (true) {
|
|
||||||
const tags = await this.client.getRepoTags(projectFullPath, { ...opts, page, perPage });
|
|
||||||
all.push(...tags.map((t) => ({ name: t.name, commitSha: t.commit.sha })));
|
|
||||||
if (tags.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
return all;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Project Secrets ---
|
// --- Project Secrets ---
|
||||||
|
|
||||||
async getProjectSecrets(projectId: string): Promise<interfaces.data.ISecret[]> {
|
async getProjectSecrets(projectId: string): Promise<interfaces.data.ISecret[]> {
|
||||||
const secrets = await this.client.getRepoSecrets(projectId);
|
const repo = await this.client.getRepo(projectId);
|
||||||
|
const secrets = await repo.getSecrets();
|
||||||
return secrets.map((s) => this.mapSecret(s, 'project', projectId));
|
return secrets.map((s) => this.mapSecret(s, 'project', projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +66,8 @@ export class GiteaProvider extends BaseProvider {
|
|||||||
key: string,
|
key: string,
|
||||||
value: string,
|
value: string,
|
||||||
): Promise<interfaces.data.ISecret> {
|
): Promise<interfaces.data.ISecret> {
|
||||||
await this.client.setRepoSecret(projectId, key, value);
|
const repo = await this.client.getRepo(projectId);
|
||||||
|
await repo.setSecret(key, value);
|
||||||
return { key, value: '***', protected: false, masked: true, scope: 'project', scopeId: projectId, scopeName: projectId, connectionId: this.connectionId, environment: '*' };
|
return { key, value: '***', protected: false, masked: true, scope: 'project', scopeId: projectId, scopeName: projectId, connectionId: this.connectionId, environment: '*' };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,13 +80,15 @@ export class GiteaProvider extends BaseProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async deleteProjectSecret(projectId: string, key: string): Promise<void> {
|
async deleteProjectSecret(projectId: string, key: string): Promise<void> {
|
||||||
await this.client.deleteRepoSecret(projectId, key);
|
const repo = await this.client.getRepo(projectId);
|
||||||
|
await repo.deleteSecret(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Group Secrets ---
|
// --- Group Secrets ---
|
||||||
|
|
||||||
async getGroupSecrets(groupId: string): Promise<interfaces.data.ISecret[]> {
|
async getGroupSecrets(groupId: string): Promise<interfaces.data.ISecret[]> {
|
||||||
const secrets = await this.client.getOrgSecrets(groupId);
|
const org = await this.client.getOrg(groupId);
|
||||||
|
const secrets = await org.getSecrets();
|
||||||
return secrets.map((s) => this.mapSecret(s, 'group', groupId));
|
return secrets.map((s) => this.mapSecret(s, 'group', groupId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +97,8 @@ export class GiteaProvider extends BaseProvider {
|
|||||||
key: string,
|
key: string,
|
||||||
value: string,
|
value: string,
|
||||||
): Promise<interfaces.data.ISecret> {
|
): Promise<interfaces.data.ISecret> {
|
||||||
await this.client.setOrgSecret(groupId, key, value);
|
const org = await this.client.getOrg(groupId);
|
||||||
|
await org.setSecret(key, value);
|
||||||
return { key, value: '***', protected: false, masked: true, scope: 'group', scopeId: groupId, scopeName: groupId, connectionId: this.connectionId, environment: '*' };
|
return { key, value: '***', protected: false, masked: true, scope: 'group', scopeId: groupId, scopeName: groupId, connectionId: this.connectionId, environment: '*' };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +111,8 @@ export class GiteaProvider extends BaseProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async deleteGroupSecret(groupId: string, key: string): Promise<void> {
|
async deleteGroupSecret(groupId: string, key: string): Promise<void> {
|
||||||
await this.client.deleteOrgSecret(groupId, key);
|
const org = await this.client.getOrg(groupId);
|
||||||
|
await org.deleteSecret(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Pipelines (Action Runs) ---
|
// --- Pipelines (Action Runs) ---
|
||||||
@@ -185,7 +121,8 @@ export class GiteaProvider extends BaseProvider {
|
|||||||
projectId: string,
|
projectId: string,
|
||||||
opts?: IPipelineListOptions,
|
opts?: IPipelineListOptions,
|
||||||
): Promise<interfaces.data.IPipeline[]> {
|
): Promise<interfaces.data.IPipeline[]> {
|
||||||
const runs = await this.client.getActionRuns(projectId, {
|
const repo = await this.client.getRepo(projectId);
|
||||||
|
const runs = await repo.getActionRuns({
|
||||||
page: opts?.page,
|
page: opts?.page,
|
||||||
perPage: opts?.perPage,
|
perPage: opts?.perPage,
|
||||||
status: opts?.status,
|
status: opts?.status,
|
||||||
@@ -199,90 +136,101 @@ export class GiteaProvider extends BaseProvider {
|
|||||||
projectId: string,
|
projectId: string,
|
||||||
pipelineId: string,
|
pipelineId: string,
|
||||||
): Promise<interfaces.data.IPipelineJob[]> {
|
): Promise<interfaces.data.IPipelineJob[]> {
|
||||||
const jobs = await this.client.getActionRunJobs(projectId, Number(pipelineId));
|
// Use the client's internal method directly to avoid an extra getRepo call
|
||||||
return jobs.map((j) => this.mapJob(j, pipelineId));
|
const jobs = await this.client.requestGetActionRunJobs(projectId, Number(pipelineId));
|
||||||
|
return jobs.map((j) => {
|
||||||
|
const resolvedStatus = plugins.giteaClient.resolveGiteaStatus(j.status, j.conclusion);
|
||||||
|
return this.mapJob(resolvedStatus, j, pipelineId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getJobLog(projectId: string, jobId: string): Promise<string> {
|
async getJobLog(projectId: string, jobId: string): Promise<string> {
|
||||||
return this.client.getJobLog(projectId, Number(jobId));
|
return this.client.requestGetJobLog(projectId, Number(jobId));
|
||||||
}
|
}
|
||||||
|
|
||||||
async retryPipeline(projectId: string, pipelineId: string): Promise<void> {
|
async retryPipeline(projectId: string, pipelineId: string): Promise<void> {
|
||||||
await this.client.rerunAction(projectId, Number(pipelineId));
|
// Fetch the run to get its workflow path, then dispatch
|
||||||
|
const run = await this.client.requestGetActionRun(projectId, Number(pipelineId));
|
||||||
|
const wfId = plugins.giteaClient.extractWorkflowIdFromPath(run.path);
|
||||||
|
const ref = run.head_branch || 'main';
|
||||||
|
if (!wfId) {
|
||||||
|
throw new Error(`Cannot retry: no workflow ID found in path "${run.path}"`);
|
||||||
|
}
|
||||||
|
await this.client.requestDispatchWorkflow(projectId, wfId, ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
async cancelPipeline(projectId: string, pipelineId: string): Promise<void> {
|
async cancelPipeline(_projectId: string, _pipelineId: string): Promise<void> {
|
||||||
await this.client.cancelAction(projectId, Number(pipelineId));
|
throw new Error('Cancel is not supported by Gitea 1.25');
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Mappers ---
|
// --- Mappers ---
|
||||||
|
|
||||||
private mapProject(r: plugins.giteaClient.IGiteaRepository): interfaces.data.IProject {
|
private mapProject(r: plugins.giteaClient.GiteaRepository): interfaces.data.IProject {
|
||||||
return {
|
return {
|
||||||
id: r.full_name || String(r.id),
|
id: r.fullName || String(r.id),
|
||||||
name: r.name || '',
|
name: r.name,
|
||||||
fullPath: r.full_name || '',
|
fullPath: r.fullName,
|
||||||
description: r.description || '',
|
description: r.description,
|
||||||
defaultBranch: r.default_branch || 'main',
|
defaultBranch: r.defaultBranch,
|
||||||
webUrl: r.html_url || '',
|
webUrl: r.htmlUrl,
|
||||||
connectionId: this.connectionId,
|
connectionId: this.connectionId,
|
||||||
visibility: r.private ? 'private' : 'public',
|
visibility: r.isPrivate ? 'private' : 'public',
|
||||||
topics: r.topics || [],
|
topics: r.topics,
|
||||||
lastActivity: r.updated_at || '',
|
lastActivity: r.updatedAt,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapGroup(o: plugins.giteaClient.IGiteaOrganization): interfaces.data.IGroup {
|
private mapGroup(o: plugins.giteaClient.GiteaOrganization): interfaces.data.IGroup {
|
||||||
return {
|
return {
|
||||||
id: o.name || String(o.id),
|
id: o.name || String(o.id),
|
||||||
name: o.name || '',
|
name: o.name,
|
||||||
fullPath: o.name || '',
|
fullPath: o.name,
|
||||||
description: o.description || '',
|
description: o.description,
|
||||||
webUrl: `${this.baseUrl}/${o.name}`,
|
webUrl: `${this.baseUrl}/${o.name}`,
|
||||||
connectionId: this.connectionId,
|
connectionId: this.connectionId,
|
||||||
visibility: o.visibility || 'public',
|
visibility: o.visibility || 'public',
|
||||||
projectCount: o.repo_count || 0,
|
projectCount: o.repoCount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapSecret(s: plugins.giteaClient.IGiteaSecret, scope: 'project' | 'group', scopeId: string, scopeName?: string): interfaces.data.ISecret {
|
private mapSecret(s: plugins.giteaClient.GiteaSecret, scope: 'project' | 'group', scopeId: string): interfaces.data.ISecret {
|
||||||
return {
|
return {
|
||||||
key: s.name || '',
|
key: s.name,
|
||||||
value: '***',
|
value: '***',
|
||||||
protected: false,
|
protected: false,
|
||||||
masked: true,
|
masked: true,
|
||||||
scope,
|
scope,
|
||||||
scopeId,
|
scopeId,
|
||||||
scopeName: scopeName || scopeId,
|
scopeName: scopeId,
|
||||||
connectionId: this.connectionId,
|
connectionId: this.connectionId,
|
||||||
environment: '*',
|
environment: '*',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapPipeline(r: plugins.giteaClient.IGiteaActionRun, projectId: string, projectName?: string): interfaces.data.IPipeline {
|
private mapPipeline(r: plugins.giteaClient.GiteaActionRun, projectId: string): interfaces.data.IPipeline {
|
||||||
return {
|
return {
|
||||||
id: String(r.id),
|
id: String(r.id),
|
||||||
projectId,
|
projectId,
|
||||||
projectName: projectName || projectId,
|
projectName: projectId,
|
||||||
connectionId: this.connectionId,
|
connectionId: this.connectionId,
|
||||||
status: this.mapStatus(r.status || r.conclusion),
|
status: this.mapStatus(r.resolvedStatus),
|
||||||
ref: r.head_branch || '',
|
ref: r.ref,
|
||||||
sha: r.head_sha || '',
|
sha: r.headSha,
|
||||||
webUrl: r.html_url || '',
|
webUrl: r.htmlUrl,
|
||||||
duration: r.run_duration || 0,
|
duration: r.duration,
|
||||||
createdAt: r.created_at || '',
|
createdAt: r.startedAt,
|
||||||
source: r.event || 'push',
|
source: r.event || 'push',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapJob(j: plugins.giteaClient.IGiteaActionRunJob, pipelineId: string): interfaces.data.IPipelineJob {
|
private mapJob(resolvedStatus: string, j: plugins.giteaClient.IGiteaActionRunJob, pipelineId: string): interfaces.data.IPipelineJob {
|
||||||
return {
|
return {
|
||||||
id: String(j.id),
|
id: String(j.id),
|
||||||
pipelineId,
|
pipelineId,
|
||||||
name: j.name || '',
|
name: j.name || '',
|
||||||
stage: j.name || 'default',
|
stage: j.name || 'default',
|
||||||
status: this.mapStatus(j.status || j.conclusion),
|
status: this.mapStatus(resolvedStatus),
|
||||||
duration: j.run_duration || 0,
|
duration: plugins.giteaClient.computeDuration(j.started_at, j.completed_at),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,130 +18,47 @@ export class GitLabProvider extends BaseProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getProjects(opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
async getProjects(opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
||||||
if (this.groupFilterId) {
|
const projects = this.groupFilterId
|
||||||
// Auto-paginate group-scoped project listing
|
? await (await this.client.getGroup(this.groupFilterId)).getProjects(opts)
|
||||||
if (opts?.page) {
|
: await this.client.getProjects(opts);
|
||||||
const projects = await this.client.getGroupProjects(this.groupFilterId, opts);
|
return projects.map((p) => this.mapProject(p));
|
||||||
return projects.map((p) => this.mapProject(p));
|
|
||||||
}
|
|
||||||
const allProjects: plugins.gitlabClient.IGitLabProject[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
while (true) {
|
|
||||||
const projects = await this.client.getGroupProjects(this.groupFilterId, { ...opts, page, perPage });
|
|
||||||
allProjects.push(...projects);
|
|
||||||
if (projects.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
return allProjects.map((p) => this.mapProject(p));
|
|
||||||
}
|
|
||||||
if (opts?.page) {
|
|
||||||
const projects = await this.client.getProjects(opts);
|
|
||||||
return projects.map((p) => this.mapProject(p));
|
|
||||||
}
|
|
||||||
const allProjects: plugins.gitlabClient.IGitLabProject[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
while (true) {
|
|
||||||
const projects = await this.client.getProjects({ ...opts, page, perPage });
|
|
||||||
allProjects.push(...projects);
|
|
||||||
if (projects.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
return allProjects.map((p) => this.mapProject(p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroups(opts?: IListOptions): Promise<interfaces.data.IGroup[]> {
|
async getGroups(opts?: IListOptions): Promise<interfaces.data.IGroup[]> {
|
||||||
if (this.groupFilterId) {
|
if (this.groupFilterId) {
|
||||||
// Auto-paginate descendant groups listing
|
const group = await this.client.getGroup(this.groupFilterId);
|
||||||
if (opts?.page) {
|
const descendants = await group.getDescendantGroups(opts);
|
||||||
const groups = await this.client.getDescendantGroups(this.groupFilterId, opts);
|
return descendants.map((g) => this.mapGroup(g));
|
||||||
return groups.map((g) => this.mapGroup(g));
|
|
||||||
}
|
|
||||||
const allGroups: plugins.gitlabClient.IGitLabGroup[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
while (true) {
|
|
||||||
const groups = await this.client.getDescendantGroups(this.groupFilterId, { ...opts, page, perPage });
|
|
||||||
allGroups.push(...groups);
|
|
||||||
if (groups.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
return allGroups.map((g) => this.mapGroup(g));
|
|
||||||
}
|
}
|
||||||
if (opts?.page) {
|
const groups = await this.client.getGroups(opts);
|
||||||
const groups = await this.client.getGroups(opts);
|
return groups.map((g) => this.mapGroup(g));
|
||||||
return groups.map((g) => this.mapGroup(g));
|
|
||||||
}
|
|
||||||
const allGroups: plugins.gitlabClient.IGitLabGroup[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
while (true) {
|
|
||||||
const groups = await this.client.getGroups({ ...opts, page, perPage });
|
|
||||||
allGroups.push(...groups);
|
|
||||||
if (groups.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
return allGroups.map((g) => this.mapGroup(g));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupProjects(groupId: string, opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
async getGroupProjects(groupId: string, opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
||||||
if (opts?.page) {
|
const group = await this.client.getGroup(groupId);
|
||||||
const projects = await this.client.getGroupProjects(groupId, opts);
|
const projects = await group.getProjects(opts);
|
||||||
return projects.map((p) => this.mapProject(p));
|
return projects.map((p) => this.mapProject(p));
|
||||||
}
|
|
||||||
const allProjects: plugins.gitlabClient.IGitLabProject[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
while (true) {
|
|
||||||
const projects = await this.client.getGroupProjects(groupId, { ...opts, page, perPage });
|
|
||||||
allProjects.push(...projects);
|
|
||||||
if (projects.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
return allProjects.map((p) => this.mapProject(p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Branches / Tags ---
|
// --- Branches / Tags ---
|
||||||
|
|
||||||
async getBranches(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.IBranch[]> {
|
async getBranches(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.IBranch[]> {
|
||||||
if (opts?.page) {
|
const project = await this.client.getProject(projectFullPath);
|
||||||
const branches = await this.client.getRepoBranches(projectFullPath, opts);
|
const branches = await project.getBranches(opts);
|
||||||
return branches.map((b) => ({ name: b.name, commitSha: b.commit.id }));
|
return branches.map((b) => ({ name: b.name, commitSha: b.commitSha }));
|
||||||
}
|
|
||||||
const all: interfaces.data.IBranch[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
while (true) {
|
|
||||||
const branches = await this.client.getRepoBranches(projectFullPath, { ...opts, page, perPage });
|
|
||||||
all.push(...branches.map((b) => ({ name: b.name, commitSha: b.commit.id })));
|
|
||||||
if (branches.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
return all;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTags(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.ITag[]> {
|
async getTags(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.ITag[]> {
|
||||||
if (opts?.page) {
|
const project = await this.client.getProject(projectFullPath);
|
||||||
const tags = await this.client.getRepoTags(projectFullPath, opts);
|
const tags = await project.getTags(opts);
|
||||||
return tags.map((t) => ({ name: t.name, commitSha: t.commit.id }));
|
return tags.map((t) => ({ name: t.name, commitSha: t.commitSha }));
|
||||||
}
|
|
||||||
const all: interfaces.data.ITag[] = [];
|
|
||||||
const perPage = opts?.perPage || 50;
|
|
||||||
let page = 1;
|
|
||||||
while (true) {
|
|
||||||
const tags = await this.client.getRepoTags(projectFullPath, { ...opts, page, perPage });
|
|
||||||
all.push(...tags.map((t) => ({ name: t.name, commitSha: t.commit.id })));
|
|
||||||
if (tags.length < perPage) break;
|
|
||||||
page++;
|
|
||||||
}
|
|
||||||
return all;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Project Secrets (CI/CD Variables) ---
|
// --- Project Secrets (CI/CD Variables) ---
|
||||||
|
|
||||||
async getProjectSecrets(projectId: string): Promise<interfaces.data.ISecret[]> {
|
async getProjectSecrets(projectId: string): Promise<interfaces.data.ISecret[]> {
|
||||||
const vars = await this.client.getProjectVariables(projectId);
|
const project = await this.client.getProject(projectId);
|
||||||
|
const vars = await project.getVariables();
|
||||||
return vars.map((v) => this.mapVariable(v, 'project', projectId));
|
return vars.map((v) => this.mapVariable(v, 'project', projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +67,8 @@ export class GitLabProvider extends BaseProvider {
|
|||||||
key: string,
|
key: string,
|
||||||
value: string,
|
value: string,
|
||||||
): Promise<interfaces.data.ISecret> {
|
): Promise<interfaces.data.ISecret> {
|
||||||
const v = await this.client.createProjectVariable(projectId, key, value);
|
const project = await this.client.getProject(projectId);
|
||||||
|
const v = await project.createVariable(key, value);
|
||||||
return this.mapVariable(v, 'project', projectId);
|
return this.mapVariable(v, 'project', projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,18 +77,21 @@ export class GitLabProvider extends BaseProvider {
|
|||||||
key: string,
|
key: string,
|
||||||
value: string,
|
value: string,
|
||||||
): Promise<interfaces.data.ISecret> {
|
): Promise<interfaces.data.ISecret> {
|
||||||
const v = await this.client.updateProjectVariable(projectId, key, value);
|
const project = await this.client.getProject(projectId);
|
||||||
|
const v = await project.updateVariable(key, value);
|
||||||
return this.mapVariable(v, 'project', projectId);
|
return this.mapVariable(v, 'project', projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteProjectSecret(projectId: string, key: string): Promise<void> {
|
async deleteProjectSecret(projectId: string, key: string): Promise<void> {
|
||||||
await this.client.deleteProjectVariable(projectId, key);
|
const project = await this.client.getProject(projectId);
|
||||||
|
await project.deleteVariable(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Group Secrets (CI/CD Variables) ---
|
// --- Group Secrets (CI/CD Variables) ---
|
||||||
|
|
||||||
async getGroupSecrets(groupId: string): Promise<interfaces.data.ISecret[]> {
|
async getGroupSecrets(groupId: string): Promise<interfaces.data.ISecret[]> {
|
||||||
const vars = await this.client.getGroupVariables(groupId);
|
const group = await this.client.getGroup(groupId);
|
||||||
|
const vars = await group.getVariables();
|
||||||
return vars.map((v) => this.mapVariable(v, 'group', groupId));
|
return vars.map((v) => this.mapVariable(v, 'group', groupId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +100,8 @@ export class GitLabProvider extends BaseProvider {
|
|||||||
key: string,
|
key: string,
|
||||||
value: string,
|
value: string,
|
||||||
): Promise<interfaces.data.ISecret> {
|
): Promise<interfaces.data.ISecret> {
|
||||||
const v = await this.client.createGroupVariable(groupId, key, value);
|
const group = await this.client.getGroup(groupId);
|
||||||
|
const v = await group.createVariable(key, value);
|
||||||
return this.mapVariable(v, 'group', groupId);
|
return this.mapVariable(v, 'group', groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,12 +110,14 @@ export class GitLabProvider extends BaseProvider {
|
|||||||
key: string,
|
key: string,
|
||||||
value: string,
|
value: string,
|
||||||
): Promise<interfaces.data.ISecret> {
|
): Promise<interfaces.data.ISecret> {
|
||||||
const v = await this.client.updateGroupVariable(groupId, key, value);
|
const group = await this.client.getGroup(groupId);
|
||||||
|
const v = await group.updateVariable(key, value);
|
||||||
return this.mapVariable(v, 'group', groupId);
|
return this.mapVariable(v, 'group', groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteGroupSecret(groupId: string, key: string): Promise<void> {
|
async deleteGroupSecret(groupId: string, key: string): Promise<void> {
|
||||||
await this.client.deleteGroupVariable(groupId, key);
|
const group = await this.client.getGroup(groupId);
|
||||||
|
await group.deleteVariable(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Pipelines ---
|
// --- Pipelines ---
|
||||||
@@ -202,7 +126,8 @@ export class GitLabProvider extends BaseProvider {
|
|||||||
projectId: string,
|
projectId: string,
|
||||||
opts?: IPipelineListOptions,
|
opts?: IPipelineListOptions,
|
||||||
): Promise<interfaces.data.IPipeline[]> {
|
): Promise<interfaces.data.IPipeline[]> {
|
||||||
const pipelines = await this.client.getPipelines(projectId, {
|
const project = await this.client.getProject(projectId);
|
||||||
|
const pipelines = await project.getPipelines({
|
||||||
page: opts?.page,
|
page: opts?.page,
|
||||||
perPage: opts?.perPage,
|
perPage: opts?.perPage,
|
||||||
status: opts?.status,
|
status: opts?.status,
|
||||||
@@ -216,83 +141,82 @@ export class GitLabProvider extends BaseProvider {
|
|||||||
projectId: string,
|
projectId: string,
|
||||||
pipelineId: string,
|
pipelineId: string,
|
||||||
): Promise<interfaces.data.IPipelineJob[]> {
|
): Promise<interfaces.data.IPipelineJob[]> {
|
||||||
const jobs = await this.client.getPipelineJobs(projectId, Number(pipelineId));
|
const jobs = await this.client.requestGetPipelineJobs(projectId, Number(pipelineId));
|
||||||
return jobs.map((j) => this.mapJob(j, pipelineId));
|
return jobs.map((j) => this.mapJob(j, pipelineId));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getJobLog(projectId: string, jobId: string): Promise<string> {
|
async getJobLog(projectId: string, jobId: string): Promise<string> {
|
||||||
return this.client.getJobLog(projectId, Number(jobId));
|
return this.client.requestGetJobLog(projectId, Number(jobId));
|
||||||
}
|
}
|
||||||
|
|
||||||
async retryPipeline(projectId: string, pipelineId: string): Promise<void> {
|
async retryPipeline(projectId: string, pipelineId: string): Promise<void> {
|
||||||
await this.client.retryPipeline(projectId, Number(pipelineId));
|
await this.client.requestRetryPipeline(projectId, Number(pipelineId));
|
||||||
}
|
}
|
||||||
|
|
||||||
async cancelPipeline(projectId: string, pipelineId: string): Promise<void> {
|
async cancelPipeline(projectId: string, pipelineId: string): Promise<void> {
|
||||||
await this.client.cancelPipeline(projectId, Number(pipelineId));
|
await this.client.requestCancelPipeline(projectId, Number(pipelineId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Mappers ---
|
// --- Mappers ---
|
||||||
|
|
||||||
private mapProject(p: plugins.gitlabClient.IGitLabProject): interfaces.data.IProject {
|
private mapProject(p: plugins.gitlabClient.GitLabProject): interfaces.data.IProject {
|
||||||
return {
|
return {
|
||||||
id: String(p.id),
|
id: String(p.id),
|
||||||
name: p.name || '',
|
name: p.name,
|
||||||
fullPath: p.path_with_namespace || '',
|
fullPath: p.fullPath,
|
||||||
description: p.description || '',
|
description: p.description,
|
||||||
defaultBranch: p.default_branch || 'main',
|
defaultBranch: p.defaultBranch,
|
||||||
webUrl: p.web_url || '',
|
webUrl: p.webUrl,
|
||||||
connectionId: this.connectionId,
|
connectionId: this.connectionId,
|
||||||
visibility: p.visibility || 'private',
|
visibility: p.visibility,
|
||||||
topics: p.topics || [],
|
topics: p.topics,
|
||||||
lastActivity: p.last_activity_at || '',
|
lastActivity: p.lastActivityAt,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapGroup(g: plugins.gitlabClient.IGitLabGroup): interfaces.data.IGroup {
|
private mapGroup(g: plugins.gitlabClient.GitLabGroup): interfaces.data.IGroup {
|
||||||
return {
|
return {
|
||||||
id: String(g.id),
|
id: String(g.id),
|
||||||
name: g.name || '',
|
name: g.name,
|
||||||
fullPath: g.full_path || '',
|
fullPath: g.fullPath,
|
||||||
description: g.description || '',
|
description: g.description,
|
||||||
webUrl: g.web_url || '',
|
webUrl: g.webUrl,
|
||||||
connectionId: this.connectionId,
|
connectionId: this.connectionId,
|
||||||
visibility: g.visibility || 'private',
|
visibility: g.visibility,
|
||||||
projectCount: 0,
|
projectCount: 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapVariable(
|
private mapVariable(
|
||||||
v: plugins.gitlabClient.IGitLabVariable,
|
v: plugins.gitlabClient.GitLabVariable,
|
||||||
scope: 'project' | 'group',
|
scope: 'project' | 'group',
|
||||||
scopeId: string,
|
scopeId: string,
|
||||||
scopeName?: string,
|
|
||||||
): interfaces.data.ISecret {
|
): interfaces.data.ISecret {
|
||||||
return {
|
return {
|
||||||
key: v.key || '',
|
key: v.key,
|
||||||
value: v.value || '***',
|
value: v.value || '***',
|
||||||
protected: v.protected || false,
|
protected: v.protected,
|
||||||
masked: v.masked || false,
|
masked: v.masked,
|
||||||
scope,
|
scope,
|
||||||
scopeId,
|
scopeId,
|
||||||
scopeName: scopeName || scopeId,
|
scopeName: scopeId,
|
||||||
connectionId: this.connectionId,
|
connectionId: this.connectionId,
|
||||||
environment: v.environment_scope || '*',
|
environment: v.environmentScope,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapPipeline(p: plugins.gitlabClient.IGitLabPipeline, projectId: string, projectName?: string): interfaces.data.IPipeline {
|
private mapPipeline(p: plugins.gitlabClient.GitLabPipeline, projectId: string): interfaces.data.IPipeline {
|
||||||
return {
|
return {
|
||||||
id: String(p.id),
|
id: String(p.id),
|
||||||
projectId,
|
projectId,
|
||||||
projectName: projectName || projectId,
|
projectName: projectId,
|
||||||
connectionId: this.connectionId,
|
connectionId: this.connectionId,
|
||||||
status: (p.status || 'pending') as interfaces.data.TPipelineStatus,
|
status: (p.status || 'pending') as interfaces.data.TPipelineStatus,
|
||||||
ref: p.ref || '',
|
ref: p.ref,
|
||||||
sha: p.sha || '',
|
sha: p.sha,
|
||||||
webUrl: p.web_url || '',
|
webUrl: p.webUrl,
|
||||||
duration: p.duration || 0,
|
duration: p.duration,
|
||||||
createdAt: p.created_at || '',
|
createdAt: p.createdAt,
|
||||||
source: p.source || 'push',
|
source: p.source || 'push',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user