add option for npm access level
This commit is contained in:
@ -1,29 +1,28 @@
|
||||
import * as plugins from './mod.plugins'
|
||||
import { bash } from '../npmci.bash'
|
||||
import * as plugins from './mod.plugins';
|
||||
import { bash } from '../npmci.bash';
|
||||
|
||||
let triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/
|
||||
let triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/;
|
||||
|
||||
export let trigger = async () => {
|
||||
plugins.beautylog.info('now running triggers')
|
||||
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger)
|
||||
}
|
||||
plugins.beautylog.info('now running triggers');
|
||||
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger);
|
||||
};
|
||||
|
||||
let evaluateTrigger = async (triggerEnvVarArg) => {
|
||||
let triggerRegexResultArray = triggerValueRegex.exec(triggerEnvVarArg)
|
||||
let regexDomain = triggerRegexResultArray[1]
|
||||
let regexProjectId = triggerRegexResultArray[2]
|
||||
let regexProjectTriggerToken = triggerRegexResultArray[3]
|
||||
let regexRefName = triggerRegexResultArray[4]
|
||||
let regexTriggerName
|
||||
let evaluateTrigger = async triggerEnvVarArg => {
|
||||
let triggerRegexResultArray = triggerValueRegex.exec(triggerEnvVarArg);
|
||||
let regexDomain = triggerRegexResultArray[1];
|
||||
let regexProjectId = triggerRegexResultArray[2];
|
||||
let regexProjectTriggerToken = triggerRegexResultArray[3];
|
||||
let regexRefName = triggerRegexResultArray[4];
|
||||
let regexTriggerName;
|
||||
if (triggerRegexResultArray.length === 6) {
|
||||
regexTriggerName = triggerRegexResultArray[5]
|
||||
regexTriggerName = triggerRegexResultArray[5];
|
||||
} else {
|
||||
regexTriggerName = 'Unnamed Trigger'
|
||||
regexTriggerName = 'Unnamed Trigger';
|
||||
}
|
||||
plugins.beautylog.info('Found Trigger!')
|
||||
plugins.beautylog.log('triggering build for ref ' + regexRefName + ' of ' + regexTriggerName)
|
||||
plugins.request.post(
|
||||
'https://gitlab.com/api/v3/projects/' + regexProjectId + '/trigger/builds',
|
||||
{ form: { token: regexProjectTriggerToken, ref: regexRefName }
|
||||
})
|
||||
}
|
||||
plugins.beautylog.info('Found Trigger!');
|
||||
plugins.beautylog.log('triggering build for ref ' + regexRefName + ' of ' + regexTriggerName);
|
||||
plugins.request.post('https://gitlab.com/api/v3/projects/' + regexProjectId + '/trigger/builds', {
|
||||
form: { token: regexProjectTriggerToken, ref: regexRefName }
|
||||
});
|
||||
};
|
||||
|
@ -1 +1 @@
|
||||
export * from '../npmci.plugins'
|
||||
export * from '../npmci.plugins';
|
||||
|
Reference in New Issue
Block a user