Skip to content

Commit c694c86

Browse files
Simon Heatherjdalrymple
authored andcommitted
feat: JobArtifacts.downloadArchive: Add support for search_recent_successful_pipelines with an artifact path
1 parent 4573cb0 commit c694c86

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

packages/core/src/resources/JobArtifacts.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ export class JobArtifacts<C extends boolean = false> extends BaseResource<C> {
4545
artifactPath?: undefined;
4646
searchRecentSuccessfulPipelines?: boolean;
4747
}
48-
| { ref: string; job: string; artifactPath: string; jobId?: undefined }
48+
| {
49+
ref: string;
50+
job: string;
51+
artifactPath: string;
52+
jobId?: undefined;
53+
searchRecentSuccessfulPipelines?: boolean;
54+
}
4955
) & { jobToken?: string } & Sudo &
5056
ShowExpanded<E> = {} as any,
5157
): Promise<GitlabAPIResponse<Blob, void, E, void>> {

packages/core/test/unit/resources/JobArtifacts.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,44 @@ describe('JobArtifacts.downloadArchive', () => {
125125
},
126126
);
127127
});
128+
129+
it('should request GET /projects/:id/jobs/artifacts/:ref/raw/:artifact_path?job=:name&search_recent_successful_pipelines=true when searchRecentSuccessfulPipelines is true with artifactPath', async () => {
130+
await service.downloadArchive(1, {
131+
job: 'job1',
132+
ref: 'ref1',
133+
artifactPath: 'path',
134+
searchRecentSuccessfulPipelines: true,
135+
});
136+
137+
expect(RequestHelper.get()).toHaveBeenCalledWith(
138+
service,
139+
`projects/1/jobs/artifacts/ref1/raw/path`,
140+
{
141+
job: 'job1',
142+
searchRecentSuccessfulPipelines: true,
143+
},
144+
);
145+
});
146+
147+
it('should request GET /projects/:id/jobs/artifacts/:ref/raw/:artifact_path?job=:name&search_recent_successful_pipelines=true with artifactPath via job token', async () => {
148+
await service.downloadArchive(1, {
149+
job: 'job1',
150+
ref: 'ref1',
151+
artifactPath: 'path',
152+
jobToken: 'token',
153+
searchRecentSuccessfulPipelines: true,
154+
});
155+
156+
expect(RequestHelper.get()).toHaveBeenCalledWith(
157+
service,
158+
`projects/1/jobs/artifacts/ref1/raw/path`,
159+
{
160+
job: 'job1',
161+
jobToken: 'token',
162+
searchRecentSuccessfulPipelines: true,
163+
},
164+
);
165+
});
128166
});
129167

130168
describe('JobArtifacts.keep', () => {

0 commit comments

Comments
 (0)