Skip to content

Commit

Permalink
feat(3193): Add upstream remote trigger's pipeline name data into wor…
Browse files Browse the repository at this point in the history
…kflow graph node as displayName [2] (#628)
  • Loading branch information
y-oksaku authored Sep 12, 2024
1 parent b0062ef commit 152c985
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,10 @@ class PipelineModel extends BaseModel {
const externalJob = externalWorkflow.nodes.find(n => n.name === externalJobName);

if (externalJob) {
const { name, branch } = externalPipeline.scmRepo;

node.id = externalJob.id;
node.displayName = `${name}#${branch}:${externalJob.name}`;
} else {
logger.error(
`pipelineId:${externalPipelineId}: workflow has no job:${externalJobName}.`
Expand Down
6 changes: 5 additions & 1 deletion test/lib/pipeline.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,10 @@ describe('Pipeline Model', () => {
jobFactoryMock.create.withArgs(externalMock).resolves(externalModelMock);
pipelineFactoryMock.get.resolves({
id: testId,
scmRepo: {
branch: 'branch',
name: 'org/repo'
},
update: sinon.stub().resolves(null),
remove: sinon.stub().resolves(null),
workflowGraph: { nodes: [{ name: '~pr' }, { name: '~commit' }, { name: 'main', id: 3 }] }
Expand All @@ -928,7 +932,7 @@ describe('Pipeline Model', () => {
{ name: '~commit' },
{ name: 'main', id: 1 },
{ name: 'publish', id: 2 },
{ name: 'sd@123:main', id: 3 }
{ name: 'sd@123:main', displayName: 'org/repo#branch:main', id: 3 }
],
edges: [
{ src: '~pr', dest: 'main' },
Expand Down

0 comments on commit 152c985

Please sign in to comment.