Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

screwdriver-config-parser

Package Overview
Dependencies
Maintainers
8
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

screwdriver-config-parser - npm Package Compare versions

Comparing version 8.0.4 to 8.1.0

50

lib/phase/flatten.js

@@ -5,2 +5,3 @@ 'use strict';

const clone = require('clone');
const { STAGE_TRIGGER } = require('screwdriver-data-schema/config/regex');

@@ -546,5 +547,5 @@ const STAGE_PREFIX = 'stage@';

* @param {String} type Type of stage job (setup or teardown)
* @return {String} Full stage name (e.g. stage@deploy:setup)
* @return {String} Full stage job name (e.g. stage@deploy:setup)
*/
function getFullStageName({ stageName, type }) {
function getFullStageJobName({ stageName, type }) {
return `${STAGE_PREFIX}${stageName}:${type}`;

@@ -583,2 +584,29 @@ }

/**
* Expands stage triggers specified in 'job.requires' to stage teardown job triggers
* Examples:
* [stage@canary, ~stage:performance, A, B, ~C] -> [stage@canary:teardown, ~stage:performance:teardown, A, B, ~C]
* stage@canary -> stage@canary:teardown
* [] -> []
*
* @param {Object} job Job
*/
function convertStageTriggerToTeardownTrigger(job) {
const converterFn = trigger => {
const result = trigger.match(STAGE_TRIGGER);
if (result && !result[2]) {
return `${trigger}:teardown`;
}
return trigger;
};
if (Array.isArray(job.requires)) {
job.requires = job.requires.map(converterFn);
} else {
job.requires = converterFn(job.requires);
}
}
/**
* Flatten stage setup and teardown into jobs object

@@ -593,14 +621,20 @@ * @param {Object} doc Document that went through structural parsing

Object.keys(stages).forEach(stageName => {
const { setup, teardown, jobs: stageJobs } = stages[stageName];
const { setup, teardown, jobs: stageJobNames } = stages[stageName];
let stageSetup = setup;
let stageTeardown = teardown;
stageJobs.forEach(jobName => {
if (newJobs[jobName]) {
newJobs[jobName].stage = { name: stageName };
Object.entries(newJobs).forEach(([jobName, job]) => {
if (stageJobNames.includes(jobName)) {
job.stage = { name: stageName };
if (!job.requires || job.requires.length === 0) {
job.requires = `~${getFullStageJobName({ stageName, type: 'setup' })}`;
}
} else if (job.requires) {
convertStageTriggerToTeardownTrigger(job);
}
});
const setupStageName = getFullStageName({ stageName, type: 'setup' });
const teardownStageName = getFullStageName({ stageName, type: 'teardown' });
const setupStageName = getFullStageJobName({ stageName, type: 'setup' });
const teardownStageName = getFullStageJobName({ stageName, type: 'teardown' });

@@ -607,0 +641,0 @@ // Implicitly create setup/teardown

2

package.json
{
"name": "screwdriver-config-parser",
"version": "8.0.4",
"version": "8.1.0",
"description": "Node module for parsing screwdriver.yaml configurations",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc