Skip to content

Commit 10744ec

Browse files
authored
Remove artifacts in start of job instead of relying on --needs (#1569)
1 parent 0819438 commit 10744ec

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/handler.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ export async function handler (args: any, writeStreams: WriteStreams, jobs: Job[
6767
generateGitIgnore(cwd, stateDir);
6868
const time = process.hrtime();
6969
if (argv.needs || argv.onlyNeeds) {
70-
await fs.remove(`${cwd}/${stateDir}/artifacts`);
7170
await state.incrementPipelineIid(cwd, stateDir);
7271
}
7372
const pipelineIid = await state.getPipelineIid(cwd, stateDir);
@@ -88,7 +87,6 @@ export async function handler (args: any, writeStreams: WriteStreams, jobs: Job[
8887
} else {
8988
generateGitIgnore(cwd, stateDir);
9089
const time = process.hrtime();
91-
if (childPipelineDepth == 0) await fs.remove(`${cwd}/${stateDir}/artifacts`);
9290
await state.incrementPipelineIid(cwd, stateDir);
9391
const pipelineIid = await state.getPipelineIid(cwd, stateDir);
9492
parser = await Parser.create(argv, writeStreams, pipelineIid, jobs);

src/job.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ export class Job {
476476
const prefix = this.jobData["cache"][index]["key"]["prefix"];
477477
if (prefix) {
478478
return `${index}_${Utils.expandText(prefix, expanded)}-`;
479-
};
479+
}
480480

481481
const filenames = this.jobData["cache"][index]["key"]["files"].map((p: string) => {
482482
const expandP = Utils.expandText(p, expanded);
@@ -806,6 +806,8 @@ export class Job {
806806

807807
if (message.length > 0) writeStreams.stdout(chalk`${this.formattedJobName} {magentaBright ${message}}\n`);
808808

809+
await fs.remove(`${cwd}/${stateDir}/artifacts/${safeJobName}`);
810+
809811
// Copy git tracked files to build folder if shell isolation enabled.
810812
if (!imageName && this.argv.shellIsolation) {
811813
await Utils.rsyncTrackedFiles(cwd, stateDir, `${safeJobName}`);

0 commit comments

Comments
 (0)