Skip to content
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

feat(2331): Expand step object for job validation [1] #437

Merged
merged 4 commits into from
Feb 16, 2021
Merged

feat(2331): Expand step object for job validation [1] #437

merged 4 commits into from
Feb 16, 2021

Conversation

tkyi
Copy link
Member

@tkyi tkyi commented Feb 12, 2021

Context

It would be nice if template owners could indicate which steps cannot be overwritten in their templates. In order to allow for this change (and other step expansions), it would be nice if steps can be expanded to more than just a string or single key-value object.

Objective

This PR adds the option to expand step object from previous formats 'npm publish'/{ deploy: npm publish } to allow for more complex objects { deploy: { command: 'npm publish', locked: true } }.
Also adds locked field to step.

References

Related to screwdriver-cd/screwdriver#2331

License

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(table, 'locked', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be we adding individual columns for use cases like retry, continue on error ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's better for validation and quicker lookup

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but for template key probably don't need that actually

config/job.js Show resolved Hide resolved
@tkyi tkyi changed the title feat(2331): Add locked field to template step; expand step object [1] feat(2331): Expand step object [1] Feb 15, 2021
@tkyi tkyi changed the title feat(2331): Expand step object [1] feat(2331): Expand step object for job validation [1] Feb 15, 2021
// Template steps
const SCHEMA_TEMPLATE_STEP_SUBOBJECT = SCHEMA_STEP_SUBOBJECT_BASE
.keys({
locked: Joi.boolean()
Copy link
Member

@jithine jithine Feb 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be optional ? should we allow users to define the step object format without any attributes ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's okay
the template-validator/config-parser can convert the non-attribute step objects to the simplified version

config/job.js Outdated Show resolved Hide resolved
@tkyi tkyi merged commit b3edd66 into master Feb 16, 2021
@tkyi tkyi deleted the locked branch February 16, 2021 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants