-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BREAKING CHANGE: refactor into libraries. add join flag. support multiple pr jobs #2
Conversation
lib/getNextJobs.js
Outdated
/** | ||
* Calculate the next jobs to execute, given a workflow and a trigger job | ||
* @method getNextJobs | ||
* @param {Object} workflow Directed graph representation of workflow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename this variable to workflowGraph
so we don't get it mixed up with the old concept of workflow
?
lib/getNextJobs.js
Outdated
workflow.edges.forEach((edge) => { | ||
if (edge.src === obj.trigger) { | ||
// Make PR jobs PR-$num:$cloneJob (not sure how to better handle multiple PR jobs) | ||
jobs.add(obj.trigger === '~pr' ? `PR-${obj.prNum}:${edge.dest}` : edge.dest); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're going with PR-${obj.prNum}-${edge.dest}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use :
cuz jobName can actually contains/start with -
.
lib/getWorkflow.js
Outdated
if (useLegacy && !hasRequiresConfig) { | ||
// Work out whether there is a user defined workflow, | ||
// or if we use the order of jobs defined in jobConfig | ||
const workflow = Array.isArray(pipelineConfig.workflow) ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it goes through the config parser, if will add main
to the workflow. And workflow saved in the pipeline will always have that main job in workflow.
https://api.screwdriver.cd/v4/pipelines
Can we have some check for pipelineConfig.workflow
? If it has main then take it out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
README.md
Outdated
const { getWorkflow, getNextJobs } = require('screwdriver-workflow-parser'); | ||
|
||
// Calculate the directed graph workflow from a pipeline config (and parse legacy workflows) | ||
const workflowGraph = getWorkflow({ config: pipelineConfig, useLegacy: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to update examples here
lib/getNextJobs.js
Outdated
* @param {String} [obj.prNum] The PR number (required when ~pr trigger) | ||
* @return {Array} List of job names | ||
*/ | ||
const getNextJobs = (workflowGraph, obj) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably want to use "config" to be consistent
lib/getWorkflow.js
Outdated
/** | ||
* Given a pipeline config, return a directed graph configuration that describes the workflow | ||
* @method getWorkflow | ||
* @param {Object} pipeline A Pipeline Config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update JSdocs to match new arg name (pipelineConfig
)
BREAKING CHANGE: altered the signature for getWorkflow, getNextJobs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context:
Planning ahead to add workflow cycle detection, but wanted to get api changes out sooner.
Objective: