2020-02-20 21:28:14 -05:00
module . exports =
/******/ ( function ( modules , runtime ) { // webpackBootstrap
/******/ "use strict" ;
/******/ // The module cache
/******/ var installedModules = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/
/******/ // Check if module is in cache
/******/ if ( installedModules [ moduleId ] ) {
/******/ return installedModules [ moduleId ] . exports ;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
/******/ i : moduleId ,
/******/ l : false ,
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Flag the module as loaded
/******/ module . l = true ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/
/******/
/******/ _ _webpack _require _ _ . ab = _ _dirname + "/" ;
/******/
/******/ // the startup function
/******/ function startup ( ) {
/******/ // Load entry module and return exports
/******/ return _ _webpack _require _ _ ( 385 ) ;
/******/ } ;
/******/
/******/ // run startup
/******/ return startup ( ) ;
/******/ } )
/************************************************************************/
/******/ ( {
/***/ 16 :
/***/ ( function ( module ) {
module . exports = require ( "tls" ) ;
/***/ } ) ,
/***/ 82 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const fs = _ _importStar ( _ _webpack _require _ _ ( 747 ) ) ;
const core _1 = _ _webpack _require _ _ ( 470 ) ;
const path _1 = _ _webpack _require _ _ ( 622 ) ;
const internal _utils _1 = _ _webpack _require _ _ ( 931 ) ;
/ * *
* Creates a specification that describes how each file that is part of the artifact will be uploaded
* @ param artifactName the name of the artifact being uploaded . Used during upload to denote where the artifact is stored on the server
* @ param rootDirectory an absolute file path that denotes the path that should be removed from the beginning of each artifact file
* @ param artifactFiles a list of absolute file paths that denote what should be uploaded as part of the artifact
* /
function getUploadSpecification ( artifactName , rootDirectory , artifactFiles ) {
internal _utils _1 . checkArtifactName ( artifactName ) ;
const specifications = [ ] ;
if ( ! fs . existsSync ( rootDirectory ) ) {
throw new Error ( ` Provided rootDirectory ${ rootDirectory } does not exist ` ) ;
}
if ( ! fs . lstatSync ( rootDirectory ) . isDirectory ( ) ) {
throw new Error ( ` Provided rootDirectory ${ rootDirectory } is not a valid directory ` ) ;
}
// Normalize and resolve, this allows for either absolute or relative paths to be used
rootDirectory = path _1 . normalize ( rootDirectory ) ;
rootDirectory = path _1 . resolve ( rootDirectory ) ;
/ *
Example to demonstrate behavior
Input :
artifactName : my - artifact
rootDirectory : '/home/user/files/plz-upload'
artifactFiles : [
'/home/user/files/plz-upload/file1.txt' ,
'/home/user/files/plz-upload/file2.txt' ,
'/home/user/files/plz-upload/dir/file3.txt'
]
Output :
specifications : [
[ '/home/user/files/plz-upload/file1.txt' , 'my-artifact/file1.txt' ] ,
[ '/home/user/files/plz-upload/file1.txt' , 'my-artifact/file2.txt' ] ,
[ '/home/user/files/plz-upload/file1.txt' , 'my-artifact/dir/file3.txt' ]
]
* /
for ( let file of artifactFiles ) {
if ( ! fs . existsSync ( file ) ) {
throw new Error ( ` File ${ file } does not exist ` ) ;
}
if ( ! fs . lstatSync ( file ) . isDirectory ( ) ) {
// Normalize and resolve, this allows for either absolute or relative paths to be used
file = path _1 . normalize ( file ) ;
file = path _1 . resolve ( file ) ;
if ( ! file . startsWith ( rootDirectory ) ) {
throw new Error ( ` The rootDirectory: ${ rootDirectory } is not a parent directory of the file: ${ file } ` ) ;
}
/ *
uploadFilePath denotes where the file will be uploaded in the file container on the server . During a run , if multiple artifacts are uploaded , they will all
be saved in the same container . The artifact name is used as the root directory in the container to separate and distinguish uploaded artifacts
path . join handles all the following cases and would return ' artifact - name / file - to - upload . txt
join ( 'artifact-name/' , 'file-to-upload.txt' )
join ( 'artifact-name/' , '/file-to-upload.txt' )
join ( 'artifact-name' , 'file-to-upload.txt' )
join ( 'artifact-name' , '/file-to-upload.txt' )
* /
specifications . push ( {
absoluteFilePath : file ,
uploadFilePath : path _1 . join ( artifactName , file . replace ( rootDirectory , '' ) )
} ) ;
}
else {
// Directories are rejected by the server during upload
core _1 . debug ( ` Removing ${ file } from rawSearchResults because it is a directory ` ) ;
}
}
return specifications ;
}
exports . getUploadSpecification = getUploadSpecification ;
//# sourceMappingURL=internal-upload-specification.js.map
/***/ } ) ,
/***/ 87 :
/***/ ( function ( module ) {
module . exports = require ( "os" ) ;
/***/ } ) ,
/***/ 93 :
/***/ ( function ( module , _ _unusedexports , _ _webpack _require _ _ ) {
module . exports = minimatch
minimatch . Minimatch = Minimatch
var path = { sep : '/' }
try {
path = _ _webpack _require _ _ ( 622 )
} catch ( er ) { }
var GLOBSTAR = minimatch . GLOBSTAR = Minimatch . GLOBSTAR = { }
var expand = _ _webpack _require _ _ ( 306 )
var plTypes = {
'!' : { open : '(?:(?!(?:' , close : '))[^/]*?)' } ,
'?' : { open : '(?:' , close : ')?' } ,
'+' : { open : '(?:' , close : ')+' } ,
'*' : { open : '(?:' , close : ')*' } ,
'@' : { open : '(?:' , close : ')' }
}
// any single thing other than /
// don't need to escape / when using new RegExp()
var qmark = '[^/]'
// * => any number of characters
var star = qmark + '*?'
// ** when dots are allowed. Anything goes, except .. and .
// not (^ or / followed by one or two dots followed by $ or /),
// followed by anything, any number of times.
var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
// not a ^ or / followed by a dot,
// followed by anything, any number of times.
var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
// characters that need to be escaped in RegExp.
var reSpecials = charSet ( '().*{}+?[]^$\\!' )
// "abc" -> { a:true, b:true, c:true }
function charSet ( s ) {
return s . split ( '' ) . reduce ( function ( set , c ) {
set [ c ] = true
return set
} , { } )
}
// normalizes slashes.
var slashSplit = /\/+/
minimatch . filter = filter
function filter ( pattern , options ) {
options = options || { }
return function ( p , i , list ) {
return minimatch ( p , pattern , options )
}
}
function ext ( a , b ) {
a = a || { }
b = b || { }
var t = { }
Object . keys ( b ) . forEach ( function ( k ) {
t [ k ] = b [ k ]
} )
Object . keys ( a ) . forEach ( function ( k ) {
t [ k ] = a [ k ]
} )
return t
}
minimatch . defaults = function ( def ) {
if ( ! def || ! Object . keys ( def ) . length ) return minimatch
var orig = minimatch
var m = function minimatch ( p , pattern , options ) {
return orig . minimatch ( p , pattern , ext ( def , options ) )
}
m . Minimatch = function Minimatch ( pattern , options ) {
return new orig . Minimatch ( pattern , ext ( def , options ) )
}
return m
}
Minimatch . defaults = function ( def ) {
if ( ! def || ! Object . keys ( def ) . length ) return Minimatch
return minimatch . defaults ( def ) . Minimatch
}
function minimatch ( p , pattern , options ) {
if ( typeof pattern !== 'string' ) {
throw new TypeError ( 'glob pattern string required' )
}
if ( ! options ) options = { }
// shortcut: comments match nothing.
if ( ! options . nocomment && pattern . charAt ( 0 ) === '#' ) {
return false
}
// "" only matches ""
if ( pattern . trim ( ) === '' ) return p === ''
return new Minimatch ( pattern , options ) . match ( p )
}
function Minimatch ( pattern , options ) {
if ( ! ( this instanceof Minimatch ) ) {
return new Minimatch ( pattern , options )
}
if ( typeof pattern !== 'string' ) {
throw new TypeError ( 'glob pattern string required' )
}
if ( ! options ) options = { }
pattern = pattern . trim ( )
// windows support: need to use /, not \
if ( path . sep !== '/' ) {
pattern = pattern . split ( path . sep ) . join ( '/' )
}
this . options = options
this . set = [ ]
this . pattern = pattern
this . regexp = null
this . negate = false
this . comment = false
this . empty = false
// make the set of regexps etc.
this . make ( )
}
Minimatch . prototype . debug = function ( ) { }
Minimatch . prototype . make = make
function make ( ) {
// don't do it more than once.
if ( this . _made ) return
var pattern = this . pattern
var options = this . options
// empty patterns and comments match nothing.
if ( ! options . nocomment && pattern . charAt ( 0 ) === '#' ) {
this . comment = true
return
}
if ( ! pattern ) {
this . empty = true
return
}
// step 1: figure out negation, etc.
this . parseNegate ( )
// step 2: expand braces
var set = this . globSet = this . braceExpand ( )
if ( options . debug ) this . debug = console . error
this . debug ( this . pattern , set )
// step 3: now we have a set, so turn each one into a series of path-portion
// matching patterns.
// These will be regexps, except in the case of "**", which is
// set to the GLOBSTAR object for globstar behavior,
// and will not contain any / characters
set = this . globParts = set . map ( function ( s ) {
return s . split ( slashSplit )
} )
this . debug ( this . pattern , set )
// glob --> regexps
set = set . map ( function ( s , si , set ) {
return s . map ( this . parse , this )
} , this )
this . debug ( this . pattern , set )
// filter out everything that didn't compile properly.
set = set . filter ( function ( s ) {
return s . indexOf ( false ) === - 1
} )
this . debug ( this . pattern , set )
this . set = set
}
Minimatch . prototype . parseNegate = parseNegate
function parseNegate ( ) {
var pattern = this . pattern
var negate = false
var options = this . options
var negateOffset = 0
if ( options . nonegate ) return
for ( var i = 0 , l = pattern . length
; i < l && pattern . charAt ( i ) === '!'
; i ++ ) {
negate = ! negate
negateOffset ++
}
if ( negateOffset ) this . pattern = pattern . substr ( negateOffset )
this . negate = negate
}
// Brace expansion:
// a{b,c}d -> abd acd
// a{b,}c -> abc ac
// a{0..3}d -> a0d a1d a2d a3d
// a{b,c{d,e}f}g -> abg acdfg acefg
// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
//
// Invalid sets are not expanded.
// a{2..}b -> a{2..}b
// a{b}c -> a{b}c
minimatch . braceExpand = function ( pattern , options ) {
return braceExpand ( pattern , options )
}
Minimatch . prototype . braceExpand = braceExpand
function braceExpand ( pattern , options ) {
if ( ! options ) {
if ( this instanceof Minimatch ) {
options = this . options
} else {
options = { }
}
}
pattern = typeof pattern === 'undefined'
? this . pattern : pattern
if ( typeof pattern === 'undefined' ) {
throw new TypeError ( 'undefined pattern' )
}
if ( options . nobrace ||
! pattern . match ( /\{.*\}/ ) ) {
// shortcut. no need to expand.
return [ pattern ]
}
return expand ( pattern )
}
// parse a component of the expanded set.
// At this point, no pattern may contain "/" in it
// so we're going to return a 2d array, where each entry is the full
// pattern, split on '/', and then turned into a regular expression.
// A regexp is made at the end which joins each array with an
// escaped /, and another full one which joins each regexp with |.
//
// Following the lead of Bash 4.1, note that "**" only has special meaning
// when it is the *only* thing in a path portion. Otherwise, any series
// of * is equivalent to a single *. Globstar behavior is enabled by
// default, and can be disabled by setting options.noglobstar.
Minimatch . prototype . parse = parse
var SUBPARSE = { }
function parse ( pattern , isSub ) {
if ( pattern . length > 1024 * 64 ) {
throw new TypeError ( 'pattern is too long' )
}
var options = this . options
// shortcuts
if ( ! options . noglobstar && pattern === '**' ) return GLOBSTAR
if ( pattern === '' ) return ''
var re = ''
var hasMagic = ! ! options . nocase
var escaping = false
// ? => one single character
var patternListStack = [ ]
var negativeLists = [ ]
var stateChar
var inClass = false
var reClassStart = - 1
var classStart = - 1
// . and .. never match anything that doesn't start with .,
// even when options.dot is set.
var patternStart = pattern . charAt ( 0 ) === '.' ? '' // anything
// not (start or / followed by . or .. followed by / or end)
: options . dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
: '(?!\\.)'
var self = this
function clearStateChar ( ) {
if ( stateChar ) {
// we had some state-tracking character
// that wasn't consumed by this pass.
switch ( stateChar ) {
case '*' :
re += star
hasMagic = true
break
case '?' :
re += qmark
hasMagic = true
break
default :
re += '\\' + stateChar
break
}
self . debug ( 'clearStateChar %j %j' , stateChar , re )
stateChar = false
}
}
for ( var i = 0 , len = pattern . length , c
; ( i < len ) && ( c = pattern . charAt ( i ) )
; i ++ ) {
this . debug ( '%s\t%s %s %j' , pattern , i , re , c )
// skip over any that are escaped.
if ( escaping && reSpecials [ c ] ) {
re += '\\' + c
escaping = false
continue
}
switch ( c ) {
case '/' :
// completely not allowed, even escaped.
// Should already be path-split by now.
return false
case '\\' :
clearStateChar ( )
escaping = true
continue
// the various stateChar values
// for the "extglob" stuff.
case '?' :
case '*' :
case '+' :
case '@' :
case '!' :
this . debug ( '%s\t%s %s %j <-- stateChar' , pattern , i , re , c )
// all of those are literals inside a class, except that
// the glob [!a] means [^a] in regexp
if ( inClass ) {
this . debug ( ' in class' )
if ( c === '!' && i === classStart + 1 ) c = '^'
re += c
continue
}
// if we already have a stateChar, then it means
// that there was something like ** or +? in there.
// Handle the stateChar, then proceed with this one.
self . debug ( 'call clearStateChar %j' , stateChar )
clearStateChar ( )
stateChar = c
// if extglob is disabled, then +(asdf|foo) isn't a thing.
// just clear the statechar *now*, rather than even diving into
// the patternList stuff.
if ( options . noext ) clearStateChar ( )
continue
case '(' :
if ( inClass ) {
re += '('
continue
}
if ( ! stateChar ) {
re += '\\('
continue
}
patternListStack . push ( {
type : stateChar ,
start : i - 1 ,
reStart : re . length ,
open : plTypes [ stateChar ] . open ,
close : plTypes [ stateChar ] . close
} )
// negation is (?:(?!js)[^/]*)
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
this . debug ( 'plType %j %j' , stateChar , re )
stateChar = false
continue
case ')' :
if ( inClass || ! patternListStack . length ) {
re += '\\)'
continue
}
clearStateChar ( )
hasMagic = true
var pl = patternListStack . pop ( )
// negation is (?:(?!js)[^/]*)
// The others are (?:<pattern>)<type>
re += pl . close
if ( pl . type === '!' ) {
negativeLists . push ( pl )
}
pl . reEnd = re . length
continue
case '|' :
if ( inClass || ! patternListStack . length || escaping ) {
re += '\\|'
escaping = false
continue
}
clearStateChar ( )
re += '|'
continue
// these are mostly the same in regexp and glob
case '[' :
// swallow any state-tracking char before the [
clearStateChar ( )
if ( inClass ) {
re += '\\' + c
continue
}
inClass = true
classStart = i
reClassStart = re . length
re += c
continue
case ']' :
// a right bracket shall lose its special
// meaning and represent itself in
// a bracket expression if it occurs
// first in the list. -- POSIX.2 2.8.3.2
if ( i === classStart + 1 || ! inClass ) {
re += '\\' + c
escaping = false
continue
}
// handle the case where we left a class open.
// "[z-a]" is valid, equivalent to "\[z-a\]"
if ( inClass ) {
// split where the last [ was, make sure we don't have
// an invalid re. if so, re-walk the contents of the
// would-be class to re-translate any characters that
// were passed through as-is
// TODO: It would probably be faster to determine this
// without a try/catch and a new RegExp, but it's tricky
// to do safely. For now, this is safe and works.
var cs = pattern . substring ( classStart + 1 , i )
try {
RegExp ( '[' + cs + ']' )
} catch ( er ) {
// not a valid class!
var sp = this . parse ( cs , SUBPARSE )
re = re . substr ( 0 , reClassStart ) + '\\[' + sp [ 0 ] + '\\]'
hasMagic = hasMagic || sp [ 1 ]
inClass = false
continue
}
}
// finish up the class.
hasMagic = true
inClass = false
re += c
continue
default :
// swallow any state char that wasn't consumed
clearStateChar ( )
if ( escaping ) {
// no need
escaping = false
} else if ( reSpecials [ c ]
&& ! ( c === '^' && inClass ) ) {
re += '\\'
}
re += c
} // switch
} // for
// handle the case where we left a class open.
// "[abc" is valid, equivalent to "\[abc"
if ( inClass ) {
// split where the last [ was, and escape it
// this is a huge pita. We now have to re-walk
// the contents of the would-be class to re-translate
// any characters that were passed through as-is
cs = pattern . substr ( classStart + 1 )
sp = this . parse ( cs , SUBPARSE )
re = re . substr ( 0 , reClassStart ) + '\\[' + sp [ 0 ]
hasMagic = hasMagic || sp [ 1 ]
}
// handle the case where we had a +( thing at the *end*
// of the pattern.
// each pattern list stack adds 3 chars, and we need to go through
// and escape any | chars that were passed through as-is for the regexp.
// Go through and escape them, taking care not to double-escape any
// | chars that were already escaped.
for ( pl = patternListStack . pop ( ) ; pl ; pl = patternListStack . pop ( ) ) {
var tail = re . slice ( pl . reStart + pl . open . length )
this . debug ( 'setting tail' , re , pl )
// maybe some even number of \, then maybe 1 \, followed by a |
tail = tail . replace ( /((?:\\{2}){0,64})(\\?)\|/g , function ( _ , $1 , $2 ) {
if ( ! $2 ) {
// the | isn't already escaped, so escape it.
$2 = '\\'
}
// need to escape all those slashes *again*, without escaping the
// one that we need for escaping the | character. As it works out,
// escaping an even number of slashes can be done by simply repeating
// it exactly after itself. That's why this trick works.
//
// I am sorry that you have to see this.
return $1 + $1 + $2 + '|'
} )
this . debug ( 'tail=%j\n %s' , tail , tail , pl , re )
var t = pl . type === '*' ? star
: pl . type === '?' ? qmark
: '\\' + pl . type
hasMagic = true
re = re . slice ( 0 , pl . reStart ) + t + '\\(' + tail
}
// handle trailing things that only matter at the very end.
clearStateChar ( )
if ( escaping ) {
// trailing \\
re += '\\\\'
}
// only need to apply the nodot start if the re starts with
// something that could conceivably capture a dot
var addPatternStart = false
switch ( re . charAt ( 0 ) ) {
case '.' :
case '[' :
case '(' : addPatternStart = true
}
// Hack to work around lack of negative lookbehind in JS
// A pattern like: *.!(x).!(y|z) needs to ensure that a name
// like 'a.xyz.yz' doesn't match. So, the first negative
// lookahead, has to look ALL the way ahead, to the end of
// the pattern.
for ( var n = negativeLists . length - 1 ; n > - 1 ; n -- ) {
var nl = negativeLists [ n ]
var nlBefore = re . slice ( 0 , nl . reStart )
var nlFirst = re . slice ( nl . reStart , nl . reEnd - 8 )
var nlLast = re . slice ( nl . reEnd - 8 , nl . reEnd )
var nlAfter = re . slice ( nl . reEnd )
nlLast += nlAfter
// Handle nested stuff like *(*.js|!(*.json)), where open parens
// mean that we should *not* include the ) in the bit that is considered
// "after" the negated section.
var openParensBefore = nlBefore . split ( '(' ) . length - 1
var cleanAfter = nlAfter
for ( i = 0 ; i < openParensBefore ; i ++ ) {
cleanAfter = cleanAfter . replace ( /\)[+*?]?/ , '' )
}
nlAfter = cleanAfter
var dollar = ''
if ( nlAfter === '' && isSub !== SUBPARSE ) {
dollar = '$'
}
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
re = newRe
}
// if the re is not "" at this point, then we need to make sure
// it doesn't match against an empty path part.
// Otherwise a/* will match a/, which it should not.
if ( re !== '' && hasMagic ) {
re = '(?=.)' + re
}
if ( addPatternStart ) {
re = patternStart + re
}
// parsing just a piece of a larger pattern.
if ( isSub === SUBPARSE ) {
return [ re , hasMagic ]
}
// skip the regexp for non-magical patterns
// unescape anything in it, though, so that it'll be
// an exact match against a file etc.
if ( ! hasMagic ) {
return globUnescape ( pattern )
}
var flags = options . nocase ? 'i' : ''
try {
var regExp = new RegExp ( '^' + re + '$' , flags )
} catch ( er ) {
// If it was an invalid regular expression, then it can't match
// anything. This trick looks for a character after the end of
// the string, which is of course impossible, except in multi-line
// mode, but it's not a /m regex.
return new RegExp ( '$.' )
}
regExp . _glob = pattern
regExp . _src = re
return regExp
}
minimatch . makeRe = function ( pattern , options ) {
return new Minimatch ( pattern , options || { } ) . makeRe ( )
}
Minimatch . prototype . makeRe = makeRe
function makeRe ( ) {
if ( this . regexp || this . regexp === false ) return this . regexp
// at this point, this.set is a 2d array of partial
// pattern strings, or "**".
//
// It's better to use .match(). This function shouldn't
// be used, really, but it's pretty convenient sometimes,
// when you just want to work with a regex.
var set = this . set
if ( ! set . length ) {
this . regexp = false
return this . regexp
}
var options = this . options
var twoStar = options . noglobstar ? star
: options . dot ? twoStarDot
: twoStarNoDot
var flags = options . nocase ? 'i' : ''
var re = set . map ( function ( pattern ) {
return pattern . map ( function ( p ) {
return ( p === GLOBSTAR ) ? twoStar
: ( typeof p === 'string' ) ? regExpEscape ( p )
: p . _src
} ) . join ( '\\\/' )
} ) . join ( '|' )
// must match entire pattern
// ending in a * or ** will make it less strict.
re = '^(?:' + re + ')$'
// can match anything, as long as it's not this.
if ( this . negate ) re = '^(?!' + re + ').*$'
try {
this . regexp = new RegExp ( re , flags )
} catch ( ex ) {
this . regexp = false
}
return this . regexp
}
minimatch . match = function ( list , pattern , options ) {
options = options || { }
var mm = new Minimatch ( pattern , options )
list = list . filter ( function ( f ) {
return mm . match ( f )
} )
if ( mm . options . nonull && ! list . length ) {
list . push ( pattern )
}
return list
}
Minimatch . prototype . match = match
function match ( f , partial ) {
this . debug ( 'match' , f , this . pattern )
// short-circuit in the case of busted things.
// comments, etc.
if ( this . comment ) return false
if ( this . empty ) return f === ''
if ( f === '/' && partial ) return true
var options = this . options
// windows: need to use /, not \
if ( path . sep !== '/' ) {
f = f . split ( path . sep ) . join ( '/' )
}
// treat the test path as a set of pathparts.
f = f . split ( slashSplit )
this . debug ( this . pattern , 'split' , f )
// just ONE of the pattern sets in this.set needs to match
// in order for it to be valid. If negating, then just one
// match means that we have failed.
// Either way, return on the first hit.
var set = this . set
this . debug ( this . pattern , 'set' , set )
// Find the basename of the path by looking for the last non-empty segment
var filename
var i
for ( i = f . length - 1 ; i >= 0 ; i -- ) {
filename = f [ i ]
if ( filename ) break
}
for ( i = 0 ; i < set . length ; i ++ ) {
var pattern = set [ i ]
var file = f
if ( options . matchBase && pattern . length === 1 ) {
file = [ filename ]
}
var hit = this . matchOne ( file , pattern , partial )
if ( hit ) {
if ( options . flipNegate ) return true
return ! this . negate
}
}
// didn't get any hits. this is success if it's a negative
// pattern, failure otherwise.
if ( options . flipNegate ) return false
return this . negate
}
// set partial to true to test if, for example,
// "/a/b" matches the start of "/*/b/*/d"
// Partial means, if you run out of file before you run
// out of pattern, then that's fine, as long as all
// the parts match.
Minimatch . prototype . matchOne = function ( file , pattern , partial ) {
var options = this . options
this . debug ( 'matchOne' ,
{ 'this' : this , file : file , pattern : pattern } )
this . debug ( 'matchOne' , file . length , pattern . length )
for ( var fi = 0 ,
pi = 0 ,
fl = file . length ,
pl = pattern . length
; ( fi < fl ) && ( pi < pl )
; fi ++ , pi ++ ) {
this . debug ( 'matchOne loop' )
var p = pattern [ pi ]
var f = file [ fi ]
this . debug ( pattern , p , f )
// should be impossible.
// some invalid regexp stuff in the set.
if ( p === false ) return false
if ( p === GLOBSTAR ) {
this . debug ( 'GLOBSTAR' , [ pattern , p , f ] )
// "**"
// a/**/b/**/c would match the following:
// a/b/x/y/z/c
// a/x/y/z/b/c
// a/b/x/b/x/c
// a/b/c
// To do this, take the rest of the pattern after
// the **, and see if it would match the file remainder.
// If so, return success.
// If not, the ** "swallows" a segment, and try again.
// This is recursively awful.
//
// a/**/b/**/c matching a/b/x/y/z/c
// - a matches a
// - doublestar
// - matchOne(b/x/y/z/c, b/**/c)
// - b matches b
// - doublestar
// - matchOne(x/y/z/c, c) -> no
// - matchOne(y/z/c, c) -> no
// - matchOne(z/c, c) -> no
// - matchOne(c, c) yes, hit
var fr = fi
var pr = pi + 1
if ( pr === pl ) {
this . debug ( '** at the end' )
// a ** at the end will just swallow the rest.
// We have found a match.
// however, it will not swallow /.x, unless
// options.dot is set.
// . and .. are *never* matched by **, for explosively
// exponential reasons.
for ( ; fi < fl ; fi ++ ) {
if ( file [ fi ] === '.' || file [ fi ] === '..' ||
( ! options . dot && file [ fi ] . charAt ( 0 ) === '.' ) ) return false
}
return true
}
// ok, let's see if we can swallow whatever we can.
while ( fr < fl ) {
var swallowee = file [ fr ]
this . debug ( '\nglobstar while' , file , fr , pattern , pr , swallowee )
// XXX remove this slice. Just pass the start index.
if ( this . matchOne ( file . slice ( fr ) , pattern . slice ( pr ) , partial ) ) {
this . debug ( 'globstar found match!' , fr , fl , swallowee )
// found a match.
return true
} else {
// can't swallow "." or ".." ever.
// can only swallow ".foo" when explicitly asked.
if ( swallowee === '.' || swallowee === '..' ||
( ! options . dot && swallowee . charAt ( 0 ) === '.' ) ) {
this . debug ( 'dot detected!' , file , fr , pattern , pr )
break
}
// ** swallows a segment, and continue.
this . debug ( 'globstar swallow a segment, and continue' )
fr ++
}
}
// no match was found.
// However, in partial mode, we can't say this is necessarily over.
// If there's more *pattern* left, then
if ( partial ) {
// ran out of file
this . debug ( '\n>>> no match, partial?' , file , fr , pattern , pr )
if ( fr === fl ) return true
}
return false
}
// something other than **
// non-magic patterns just have to match exactly
// patterns with magic have been turned into regexps.
var hit
if ( typeof p === 'string' ) {
if ( options . nocase ) {
hit = f . toLowerCase ( ) === p . toLowerCase ( )
} else {
hit = f === p
}
this . debug ( 'string match' , p , f , hit )
} else {
hit = f . match ( p )
this . debug ( 'pattern match' , p , f , hit )
}
if ( ! hit ) return false
}
// Note: ending in / means that we'll get a final ""
// at the end of the pattern. This can only match a
// corresponding "" at the end of the file.
// If the file ends in /, then it can only match a
// a pattern that ends in /, unless the pattern just
// doesn't have any more for it. But, a/b/ should *not*
// match "a/b/*", even though "" matches against the
// [^/]*? pattern, except in partial mode, where it might
// simply not be reached yet.
// However, a/b/ should still satisfy a/*
// now either we fell off the end of the pattern, or we're done.
if ( fi === fl && pi === pl ) {
// ran out of pattern and filename at the same time.
// an exact hit!
return true
} else if ( fi === fl ) {
// ran out of file, but still had pattern left.
// this is ok if we're doing the match as part of
// a glob fs traversal.
return partial
} else if ( pi === pl ) {
// ran out of pattern, still have file left.
// this is only acceptable if we're on the very last
// empty segment of a file with a trailing slash.
// a/* should match a/b/
var emptyFileEnd = ( fi === fl - 1 ) && ( file [ fi ] === '' )
return emptyFileEnd
}
// should be unreachable.
throw new Error ( 'wtf?' )
}
// replace stuff like \* with *
function globUnescape ( s ) {
return s . replace ( /\\(.)/g , '$1' )
}
function regExpEscape ( s ) {
return s . replace ( /[-[\]{}()*+?.,\\^$|#\s]/g , '\\$&' )
}
/***/ } ) ,
/***/ 130 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _awaiter = ( this && this . _ _awaiter ) || function ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
} ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const fs = _ _importStar ( _ _webpack _require _ _ ( 747 ) ) ;
const internal _utils _1 = _ _webpack _require _ _ ( 931 ) ;
const url _1 = _ _webpack _require _ _ ( 835 ) ;
const internal _config _variables _1 = _ _webpack _require _ _ ( 717 ) ;
const core _1 = _ _webpack _require _ _ ( 470 ) ;
/ * *
* Gets a list of all artifacts that are in a specific container
* /
function listArtifacts ( ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const artifactUrl = internal _utils _1 . getArtifactUrl ( ) ;
const client = internal _utils _1 . createHttpClient ( ) ;
const requestOptions = internal _utils _1 . getRequestOptions ( 'application/json' ) ;
const rawResponse = yield client . get ( artifactUrl , requestOptions ) ;
const body = yield rawResponse . readBody ( ) ;
if ( internal _utils _1 . isSuccessStatusCode ( rawResponse . message . statusCode ) && body ) {
return JSON . parse ( body ) ;
}
// eslint-disable-next-line no-console
console . log ( rawResponse ) ;
throw new Error ( ` Unable to list artifacts for the run ` ) ;
} ) ;
}
exports . listArtifacts = listArtifacts ;
/ * *
* Fetches a set of container items that describe the contents of an artifact
* @ param artifactName the name of the artifact
* @ param containerUrl the artifact container URL for the run
* /
function getContainerItems ( artifactName , containerUrl ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
// The itemPath search parameter controls which containers will be returned
const resourceUrl = new url _1 . URL ( containerUrl ) ;
resourceUrl . searchParams . append ( 'itemPath' , artifactName ) ;
const client = internal _utils _1 . createHttpClient ( ) ;
const rawResponse = yield client . get ( resourceUrl . toString ( ) ) ;
const body = yield rawResponse . readBody ( ) ;
if ( internal _utils _1 . isSuccessStatusCode ( rawResponse . message . statusCode ) && body ) {
return JSON . parse ( body ) ;
}
// eslint-disable-next-line no-console
console . log ( rawResponse ) ;
throw new Error ( ` Unable to get ContainersItems from ${ resourceUrl } ` ) ;
} ) ;
}
exports . getContainerItems = getContainerItems ;
/ * *
* Concurrently downloads all the files that are part of an artifact
* @ param downloadItems information about what items to download and where to save them
* /
function downloadSingleArtifact ( downloadItems ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const DOWNLOAD _CONCURRENCY = internal _config _variables _1 . getDownloadFileConcurrency ( ) ;
// Limit the number of files downloaded at a single time
const parallelDownloads = [ ... new Array ( DOWNLOAD _CONCURRENCY ) . keys ( ) ] ;
const client = internal _utils _1 . createHttpClient ( ) ;
let downloadedFiles = 0 ;
yield Promise . all ( parallelDownloads . map ( ( ) => _ _awaiter ( this , void 0 , void 0 , function * ( ) {
while ( downloadedFiles < downloadItems . length ) {
const currentFileToDownload = downloadItems [ downloadedFiles ] ;
downloadedFiles += 1 ;
yield downloadIndividualFile ( client , currentFileToDownload . sourceLocation , currentFileToDownload . targetPath ) ;
}
} ) ) ) ;
} ) ;
}
exports . downloadSingleArtifact = downloadSingleArtifact ;
/ * *
* Downloads an individual file
* @ param client http client that will be used to make the necessary calls
* @ param artifactLocation origin location where a file will be downloaded from
* @ param downloadPath destination location for the file being downloaded
* /
function downloadIndividualFile ( client , artifactLocation , downloadPath ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const stream = fs . createWriteStream ( downloadPath ) ;
const response = yield client . get ( artifactLocation ) ;
if ( internal _utils _1 . isSuccessStatusCode ( response . message . statusCode ) ) {
yield pipeResponseToStream ( response , stream ) ;
}
else if ( internal _utils _1 . isRetryableStatusCode ( response . message . statusCode ) ) {
core _1 . warning ( ` Received http ${ response . message . statusCode } during file download, will retry ${ artifactLocation } after 10 seconds ` ) ;
yield new Promise ( resolve => setTimeout ( resolve , 10000 ) ) ;
const retryResponse = yield client . get ( artifactLocation ) ;
if ( internal _utils _1 . isSuccessStatusCode ( retryResponse . message . statusCode ) ) {
yield pipeResponseToStream ( response , stream ) ;
}
else {
// eslint-disable-next-line no-console
console . log ( retryResponse ) ;
throw new Error ( ` Unable to download ${ artifactLocation } ` ) ;
}
}
else {
// eslint-disable-next-line no-console
console . log ( response ) ;
throw new Error ( ` Unable to download ${ artifactLocation } ` ) ;
}
} ) ;
}
exports . downloadIndividualFile = downloadIndividualFile ;
function pipeResponseToStream ( response , stream ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
return new Promise ( resolve => {
response . message . pipe ( stream ) . on ( 'close' , ( ) => {
resolve ( ) ;
} ) ;
} ) ;
} ) ;
}
exports . pipeResponseToStream = pipeResponseToStream ;
//# sourceMappingURL=internal-download-http-client.js.map
/***/ } ) ,
/***/ 141 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var net = _ _webpack _require _ _ ( 631 ) ;
var tls = _ _webpack _require _ _ ( 16 ) ;
var http = _ _webpack _require _ _ ( 605 ) ;
var https = _ _webpack _require _ _ ( 211 ) ;
var events = _ _webpack _require _ _ ( 614 ) ;
var assert = _ _webpack _require _ _ ( 357 ) ;
var util = _ _webpack _require _ _ ( 669 ) ;
exports . httpOverHttp = httpOverHttp ;
exports . httpsOverHttp = httpsOverHttp ;
exports . httpOverHttps = httpOverHttps ;
exports . httpsOverHttps = httpsOverHttps ;
function httpOverHttp ( options ) {
var agent = new TunnelingAgent ( options ) ;
agent . request = http . request ;
return agent ;
}
function httpsOverHttp ( options ) {
var agent = new TunnelingAgent ( options ) ;
agent . request = http . request ;
agent . createSocket = createSecureSocket ;
agent . defaultPort = 443 ;
return agent ;
}
function httpOverHttps ( options ) {
var agent = new TunnelingAgent ( options ) ;
agent . request = https . request ;
return agent ;
}
function httpsOverHttps ( options ) {
var agent = new TunnelingAgent ( options ) ;
agent . request = https . request ;
agent . createSocket = createSecureSocket ;
agent . defaultPort = 443 ;
return agent ;
}
function TunnelingAgent ( options ) {
var self = this ;
self . options = options || { } ;
self . proxyOptions = self . options . proxy || { } ;
self . maxSockets = self . options . maxSockets || http . Agent . defaultMaxSockets ;
self . requests = [ ] ;
self . sockets = [ ] ;
self . on ( 'free' , function onFree ( socket , host , port , localAddress ) {
var options = toOptions ( host , port , localAddress ) ;
for ( var i = 0 , len = self . requests . length ; i < len ; ++ i ) {
var pending = self . requests [ i ] ;
if ( pending . host === options . host && pending . port === options . port ) {
// Detect the request to connect same origin server,
// reuse the connection.
self . requests . splice ( i , 1 ) ;
pending . request . onSocket ( socket ) ;
return ;
}
}
socket . destroy ( ) ;
self . removeSocket ( socket ) ;
} ) ;
}
util . inherits ( TunnelingAgent , events . EventEmitter ) ;
TunnelingAgent . prototype . addRequest = function addRequest ( req , host , port , localAddress ) {
var self = this ;
var options = mergeOptions ( { request : req } , self . options , toOptions ( host , port , localAddress ) ) ;
if ( self . sockets . length >= this . maxSockets ) {
// We are over limit so we'll add it to the queue.
self . requests . push ( options ) ;
return ;
}
// If we are under maxSockets create a new one.
self . createSocket ( options , function ( socket ) {
socket . on ( 'free' , onFree ) ;
socket . on ( 'close' , onCloseOrRemove ) ;
socket . on ( 'agentRemove' , onCloseOrRemove ) ;
req . onSocket ( socket ) ;
function onFree ( ) {
self . emit ( 'free' , socket , options ) ;
}
function onCloseOrRemove ( err ) {
self . removeSocket ( socket ) ;
socket . removeListener ( 'free' , onFree ) ;
socket . removeListener ( 'close' , onCloseOrRemove ) ;
socket . removeListener ( 'agentRemove' , onCloseOrRemove ) ;
}
} ) ;
} ;
TunnelingAgent . prototype . createSocket = function createSocket ( options , cb ) {
var self = this ;
var placeholder = { } ;
self . sockets . push ( placeholder ) ;
var connectOptions = mergeOptions ( { } , self . proxyOptions , {
method : 'CONNECT' ,
path : options . host + ':' + options . port ,
agent : false ,
headers : {
host : options . host + ':' + options . port
}
} ) ;
if ( options . localAddress ) {
connectOptions . localAddress = options . localAddress ;
}
if ( connectOptions . proxyAuth ) {
connectOptions . headers = connectOptions . headers || { } ;
connectOptions . headers [ 'Proxy-Authorization' ] = 'Basic ' +
new Buffer ( connectOptions . proxyAuth ) . toString ( 'base64' ) ;
}
debug ( 'making CONNECT request' ) ;
var connectReq = self . request ( connectOptions ) ;
connectReq . useChunkedEncodingByDefault = false ; // for v0.6
connectReq . once ( 'response' , onResponse ) ; // for v0.6
connectReq . once ( 'upgrade' , onUpgrade ) ; // for v0.6
connectReq . once ( 'connect' , onConnect ) ; // for v0.7 or later
connectReq . once ( 'error' , onError ) ;
connectReq . end ( ) ;
function onResponse ( res ) {
// Very hacky. This is necessary to avoid http-parser leaks.
res . upgrade = true ;
}
function onUpgrade ( res , socket , head ) {
// Hacky.
process . nextTick ( function ( ) {
onConnect ( res , socket , head ) ;
} ) ;
}
function onConnect ( res , socket , head ) {
connectReq . removeAllListeners ( ) ;
socket . removeAllListeners ( ) ;
if ( res . statusCode !== 200 ) {
debug ( 'tunneling socket could not be established, statusCode=%d' ,
res . statusCode ) ;
socket . destroy ( ) ;
var error = new Error ( 'tunneling socket could not be established, ' +
'statusCode=' + res . statusCode ) ;
error . code = 'ECONNRESET' ;
options . request . emit ( 'error' , error ) ;
self . removeSocket ( placeholder ) ;
return ;
}
if ( head . length > 0 ) {
debug ( 'got illegal response body from proxy' ) ;
socket . destroy ( ) ;
var error = new Error ( 'got illegal response body from proxy' ) ;
error . code = 'ECONNRESET' ;
options . request . emit ( 'error' , error ) ;
self . removeSocket ( placeholder ) ;
return ;
}
debug ( 'tunneling connection has established' ) ;
self . sockets [ self . sockets . indexOf ( placeholder ) ] = socket ;
return cb ( socket ) ;
}
function onError ( cause ) {
connectReq . removeAllListeners ( ) ;
debug ( 'tunneling socket could not be established, cause=%s\n' ,
cause . message , cause . stack ) ;
var error = new Error ( 'tunneling socket could not be established, ' +
'cause=' + cause . message ) ;
error . code = 'ECONNRESET' ;
options . request . emit ( 'error' , error ) ;
self . removeSocket ( placeholder ) ;
}
} ;
TunnelingAgent . prototype . removeSocket = function removeSocket ( socket ) {
var pos = this . sockets . indexOf ( socket )
if ( pos === - 1 ) {
return ;
}
this . sockets . splice ( pos , 1 ) ;
var pending = this . requests . shift ( ) ;
if ( pending ) {
// If we have pending requests and a socket gets closed a new one
// needs to be created to take over in the pool for the one that closed.
this . createSocket ( pending , function ( socket ) {
pending . request . onSocket ( socket ) ;
} ) ;
}
} ;
function createSecureSocket ( options , cb ) {
var self = this ;
TunnelingAgent . prototype . createSocket . call ( self , options , function ( socket ) {
var hostHeader = options . request . getHeader ( 'host' ) ;
var tlsOptions = mergeOptions ( { } , self . options , {
socket : socket ,
servername : hostHeader ? hostHeader . replace ( /:.*$/ , '' ) : options . host
} ) ;
// 0 is dummy port for v0.6
var secureSocket = tls . connect ( 0 , tlsOptions ) ;
self . sockets [ self . sockets . indexOf ( socket ) ] = secureSocket ;
cb ( secureSocket ) ;
} ) ;
}
function toOptions ( host , port , localAddress ) {
if ( typeof host === 'string' ) { // since v0.10
return {
host : host ,
port : port ,
localAddress : localAddress
} ;
}
return host ; // for v0.11 or later
}
function mergeOptions ( target ) {
for ( var i = 1 , len = arguments . length ; i < len ; ++ i ) {
var overrides = arguments [ i ] ;
if ( typeof overrides === 'object' ) {
var keys = Object . keys ( overrides ) ;
for ( var j = 0 , keyLen = keys . length ; j < keyLen ; ++ j ) {
var k = keys [ j ] ;
if ( overrides [ k ] !== undefined ) {
target [ k ] = overrides [ k ] ;
}
}
}
}
return target ;
}
var debug ;
if ( process . env . NODE _DEBUG && /\btunnel\b/ . test ( process . env . NODE _DEBUG ) ) {
debug = function ( ) {
var args = Array . prototype . slice . call ( arguments ) ;
if ( typeof args [ 0 ] === 'string' ) {
args [ 0 ] = 'TUNNEL: ' + args [ 0 ] ;
} else {
args . unshift ( 'TUNNEL:' ) ;
}
console . error . apply ( console , args ) ;
}
} else {
debug = function ( ) { } ;
}
exports . debug = debug ; // for test
/***/ } ) ,
/***/ 195 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const path = _ _importStar ( _ _webpack _require _ _ ( 622 ) ) ;
/ * *
* Creates a specification for a set of files that will be downloaded
* @ param artifactName the name of the artifact
* @ param artifactEntries a set of container entries that describe that files that make up an artifact
* @ param downloadPath the path where the artifact will be downloaded to
* @ param includeRootDirectory specifies if there should be an extra directory ( denoted by the artifact name ) where the artifact files should be downloaded to
* /
function getDownloadSpecification ( artifactName , artifactEntries , downloadPath , includeRootDirectory ) {
const directories = new Set ( ) ;
const specifications = {
rootDownloadLocation : includeRootDirectory
? path . join ( downloadPath , artifactName )
: downloadPath ,
directoryStructure : [ ] ,
filesToDownload : [ ]
} ;
for ( const entry of artifactEntries ) {
// Ignore artifacts in the container that don't begin with the same name
if ( entry . path . startsWith ( ` ${ artifactName } / ` ) ||
entry . path . startsWith ( ` ${ artifactName } \\ ` ) ) {
// normalize all separators to the local OS
const normalizedPathEntry = path . normalize ( entry . path ) ;
// entry.path always starts with the artifact name, if includeRootDirectory is false, remove the name from the beginning of the path
const filePath = path . join ( downloadPath , includeRootDirectory
? normalizedPathEntry
: normalizedPathEntry . replace ( artifactName , '' ) ) ;
// Case insensitive folder structure maintained in the backend, not every folder is created so the 'folder'
// itemType cannot be relied upon. The file must be used to determine the directory structure
if ( entry . itemType === 'file' ) {
// Get the directories that we need to create from the filePath for each individual file
directories . add ( path . dirname ( filePath ) ) ;
specifications . filesToDownload . push ( {
sourceLocation : entry . contentLocation ,
targetPath : filePath
} ) ;
}
}
}
specifications . directoryStructure = Array . from ( directories ) ;
return specifications ;
}
exports . getDownloadSpecification = getDownloadSpecification ;
//# sourceMappingURL=internal-download-specification.js.map
/***/ } ) ,
/***/ 211 :
/***/ ( function ( module ) {
module . exports = require ( "https" ) ;
/***/ } ) ,
/***/ 214 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const internal _artifact _client _1 = _ _webpack _require _ _ ( 369 ) ;
/ * *
* Constructs an ArtifactClient
* /
function create ( ) {
return internal _artifact _client _1 . DefaultArtifactClient . create ( ) ;
}
exports . create = create ;
//# sourceMappingURL=artifact-client.js.map
/***/ } ) ,
/***/ 226 :
/***/ ( function ( _ _unusedmodule , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
class BasicCredentialHandler {
constructor ( username , password ) {
this . username = username ;
this . password = password ;
}
prepareRequest ( options ) {
options . headers [ 'Authorization' ] = 'Basic ' + Buffer . from ( this . username + ':' + this . password ) . toString ( 'base64' ) ;
}
// This handler cannot handle 401
canHandleAuthentication ( response ) {
return false ;
}
handleAuthentication ( httpClient , requestInfo , objs ) {
return null ;
}
}
exports . BasicCredentialHandler = BasicCredentialHandler ;
class BearerCredentialHandler {
constructor ( token ) {
this . token = token ;
}
// currently implements pre-authorization
// TODO: support preAuth = false where it hooks on 401
prepareRequest ( options ) {
options . headers [ 'Authorization' ] = 'Bearer ' + this . token ;
}
// This handler cannot handle 401
canHandleAuthentication ( response ) {
return false ;
}
handleAuthentication ( httpClient , requestInfo , objs ) {
return null ;
}
}
exports . BearerCredentialHandler = BearerCredentialHandler ;
class PersonalAccessTokenCredentialHandler {
constructor ( token ) {
this . token = token ;
}
// currently implements pre-authorization
// TODO: support preAuth = false where it hooks on 401
prepareRequest ( options ) {
options . headers [ 'Authorization' ] = 'Basic ' + Buffer . from ( 'PAT:' + this . token ) . toString ( 'base64' ) ;
}
// This handler cannot handle 401
canHandleAuthentication ( response ) {
return false ;
}
handleAuthentication ( httpClient , requestInfo , objs ) {
return null ;
}
}
exports . PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler ;
/***/ } ) ,
/***/ 281 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _awaiter = ( this && this . _ _awaiter ) || function ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const internal _globber _1 = _ _webpack _require _ _ ( 297 ) ;
/ * *
* Constructs a globber
*
* @ param patterns Patterns separated by newlines
* @ param options Glob options
* /
function create ( patterns , options ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
return yield internal _globber _1 . DefaultGlobber . create ( patterns , options ) ;
} ) ;
}
exports . create = create ;
//# sourceMappingURL=glob.js.map
/***/ } ) ,
/***/ 297 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _awaiter = ( this && this . _ _awaiter ) || function ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
} ;
var _ _asyncValues = ( this && this . _ _asyncValues ) || function ( o ) {
if ( ! Symbol . asyncIterator ) throw new TypeError ( "Symbol.asyncIterator is not defined." ) ;
var m = o [ Symbol . asyncIterator ] , i ;
return m ? m . call ( o ) : ( o = typeof _ _values === "function" ? _ _values ( o ) : o [ Symbol . iterator ] ( ) , i = { } , verb ( "next" ) , verb ( "throw" ) , verb ( "return" ) , i [ Symbol . asyncIterator ] = function ( ) { return this ; } , i ) ;
function verb ( n ) { i [ n ] = o [ n ] && function ( v ) { return new Promise ( function ( resolve , reject ) { v = o [ n ] ( v ) , settle ( resolve , reject , v . done , v . value ) ; } ) ; } ; }
function settle ( resolve , reject , d , v ) { Promise . resolve ( v ) . then ( function ( v ) { resolve ( { value : v , done : d } ) ; } , reject ) ; }
} ;
var _ _await = ( this && this . _ _await ) || function ( v ) { return this instanceof _ _await ? ( this . v = v , this ) : new _ _await ( v ) ; }
var _ _asyncGenerator = ( this && this . _ _asyncGenerator ) || function ( thisArg , _arguments , generator ) {
if ( ! Symbol . asyncIterator ) throw new TypeError ( "Symbol.asyncIterator is not defined." ) ;
var g = generator . apply ( thisArg , _arguments || [ ] ) , i , q = [ ] ;
return i = { } , verb ( "next" ) , verb ( "throw" ) , verb ( "return" ) , i [ Symbol . asyncIterator ] = function ( ) { return this ; } , i ;
function verb ( n ) { if ( g [ n ] ) i [ n ] = function ( v ) { return new Promise ( function ( a , b ) { q . push ( [ n , v , a , b ] ) > 1 || resume ( n , v ) ; } ) ; } ; }
function resume ( n , v ) { try { step ( g [ n ] ( v ) ) ; } catch ( e ) { settle ( q [ 0 ] [ 3 ] , e ) ; } }
function step ( r ) { r . value instanceof _ _await ? Promise . resolve ( r . value . v ) . then ( fulfill , reject ) : settle ( q [ 0 ] [ 2 ] , r ) ; }
function fulfill ( value ) { resume ( "next" , value ) ; }
function reject ( value ) { resume ( "throw" , value ) ; }
function settle ( f , v ) { if ( f ( v ) , q . shift ( ) , q . length ) resume ( q [ 0 ] [ 0 ] , q [ 0 ] [ 1 ] ) ; }
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const core = _ _webpack _require _ _ ( 470 ) ;
const fs = _ _webpack _require _ _ ( 747 ) ;
const globOptionsHelper = _ _webpack _require _ _ ( 601 ) ;
const path = _ _webpack _require _ _ ( 622 ) ;
const patternHelper = _ _webpack _require _ _ ( 597 ) ;
const internal _match _kind _1 = _ _webpack _require _ _ ( 327 ) ;
const internal _pattern _1 = _ _webpack _require _ _ ( 923 ) ;
const internal _search _state _1 = _ _webpack _require _ _ ( 728 ) ;
const IS _WINDOWS = process . platform === 'win32' ;
class DefaultGlobber {
constructor ( options ) {
this . patterns = [ ] ;
this . searchPaths = [ ] ;
this . options = globOptionsHelper . getOptions ( options ) ;
}
getSearchPaths ( ) {
// Return a copy
return this . searchPaths . slice ( ) ;
}
glob ( ) {
var e _1 , _a ;
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const result = [ ] ;
try {
for ( var _b = _ _asyncValues ( this . globGenerator ( ) ) , _c ; _c = yield _b . next ( ) , ! _c . done ; ) {
const itemPath = _c . value ;
result . push ( itemPath ) ;
}
}
catch ( e _1 _1 ) { e _1 = { error : e _1 _1 } ; }
finally {
try {
if ( _c && ! _c . done && ( _a = _b . return ) ) yield _a . call ( _b ) ;
}
finally { if ( e _1 ) throw e _1 . error ; }
}
return result ;
} ) ;
}
globGenerator ( ) {
return _ _asyncGenerator ( this , arguments , function * globGenerator _1 ( ) {
// Fill in defaults options
const options = globOptionsHelper . getOptions ( this . options ) ;
// Implicit descendants?
const patterns = [ ] ;
for ( const pattern of this . patterns ) {
patterns . push ( pattern ) ;
if ( options . implicitDescendants &&
( pattern . trailingSeparator ||
pattern . segments [ pattern . segments . length - 1 ] !== '**' ) ) {
patterns . push ( new internal _pattern _1 . Pattern ( pattern . negate , pattern . segments . concat ( '**' ) ) ) ;
}
}
// Push the search paths
const stack = [ ] ;
for ( const searchPath of patternHelper . getSearchPaths ( patterns ) ) {
core . debug ( ` Search path ' ${ searchPath } ' ` ) ;
// Exists?
try {
// Intentionally using lstat. Detection for broken symlink
// will be performed later (if following symlinks).
yield _ _await ( fs . promises . lstat ( searchPath ) ) ;
}
catch ( err ) {
if ( err . code === 'ENOENT' ) {
continue ;
}
throw err ;
}
stack . unshift ( new internal _search _state _1 . SearchState ( searchPath , 1 ) ) ;
}
// Search
const traversalChain = [ ] ; // used to detect cycles
while ( stack . length ) {
// Pop
const item = stack . pop ( ) ;
// Match?
const match = patternHelper . match ( patterns , item . path ) ;
const partialMatch = ! ! match || patternHelper . partialMatch ( patterns , item . path ) ;
if ( ! match && ! partialMatch ) {
continue ;
}
// Stat
const stats = yield _ _await ( DefaultGlobber . stat ( item , options , traversalChain )
// Broken symlink, or symlink cycle detected, or no longer exists
) ;
// Broken symlink, or symlink cycle detected, or no longer exists
if ( ! stats ) {
continue ;
}
// Directory
if ( stats . isDirectory ( ) ) {
// Matched
if ( match & internal _match _kind _1 . MatchKind . Directory ) {
yield yield _ _await ( item . path ) ;
}
// Descend?
else if ( ! partialMatch ) {
continue ;
}
// Push the child items in reverse
const childLevel = item . level + 1 ;
const childItems = ( yield _ _await ( fs . promises . readdir ( item . path ) ) ) . map ( x => new internal _search _state _1 . SearchState ( path . join ( item . path , x ) , childLevel ) ) ;
stack . push ( ... childItems . reverse ( ) ) ;
}
// File
else if ( match & internal _match _kind _1 . MatchKind . File ) {
yield yield _ _await ( item . path ) ;
}
}
} ) ;
}
/ * *
* Constructs a DefaultGlobber
* /
static create ( patterns , options ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const result = new DefaultGlobber ( options ) ;
if ( IS _WINDOWS ) {
patterns = patterns . replace ( /\r\n/g , '\n' ) ;
patterns = patterns . replace ( /\r/g , '\n' ) ;
}
const lines = patterns . split ( '\n' ) . map ( x => x . trim ( ) ) ;
for ( const line of lines ) {
// Empty or comment
if ( ! line || line . startsWith ( '#' ) ) {
continue ;
}
// Pattern
else {
result . patterns . push ( new internal _pattern _1 . Pattern ( line ) ) ;
}
}
result . searchPaths . push ( ... patternHelper . getSearchPaths ( result . patterns ) ) ;
return result ;
} ) ;
}
static stat ( item , options , traversalChain ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
// Note:
// `stat` returns info about the target of a symlink (or symlink chain)
// `lstat` returns info about a symlink itself
let stats ;
if ( options . followSymbolicLinks ) {
try {
// Use `stat` (following symlinks)
stats = yield fs . promises . stat ( item . path ) ;
}
catch ( err ) {
if ( err . code === 'ENOENT' ) {
if ( options . omitBrokenSymbolicLinks ) {
core . debug ( ` Broken symlink ' ${ item . path } ' ` ) ;
return undefined ;
}
throw new Error ( ` No information found for the path ' ${ item . path } '. This may indicate a broken symbolic link. ` ) ;
}
throw err ;
}
}
else {
// Use `lstat` (not following symlinks)
stats = yield fs . promises . lstat ( item . path ) ;
}
// Note, isDirectory() returns false for the lstat of a symlink
if ( stats . isDirectory ( ) && options . followSymbolicLinks ) {
// Get the realpath
const realPath = yield fs . promises . realpath ( item . path ) ;
// Fixup the traversal chain to match the item level
while ( traversalChain . length >= item . level ) {
traversalChain . pop ( ) ;
}
// Test for a cycle
if ( traversalChain . some ( ( x ) => x === realPath ) ) {
core . debug ( ` Symlink cycle detected for path ' ${ item . path } ' and realpath ' ${ realPath } ' ` ) ;
return undefined ;
}
// Update the traversal chain
traversalChain . push ( realPath ) ;
}
return stats ;
} ) ;
}
}
exports . DefaultGlobber = DefaultGlobber ;
//# sourceMappingURL=internal-globber.js.map
/***/ } ) ,
/***/ 306 :
/***/ ( function ( module , _ _unusedexports , _ _webpack _require _ _ ) {
var concatMap = _ _webpack _require _ _ ( 896 ) ;
var balanced = _ _webpack _require _ _ ( 621 ) ;
module . exports = expandTop ;
var escSlash = '\0SLASH' + Math . random ( ) + '\0' ;
var escOpen = '\0OPEN' + Math . random ( ) + '\0' ;
var escClose = '\0CLOSE' + Math . random ( ) + '\0' ;
var escComma = '\0COMMA' + Math . random ( ) + '\0' ;
var escPeriod = '\0PERIOD' + Math . random ( ) + '\0' ;
function numeric ( str ) {
return parseInt ( str , 10 ) == str
? parseInt ( str , 10 )
: str . charCodeAt ( 0 ) ;
}
function escapeBraces ( str ) {
return str . split ( '\\\\' ) . join ( escSlash )
. split ( '\\{' ) . join ( escOpen )
. split ( '\\}' ) . join ( escClose )
. split ( '\\,' ) . join ( escComma )
. split ( '\\.' ) . join ( escPeriod ) ;
}
function unescapeBraces ( str ) {
return str . split ( escSlash ) . join ( '\\' )
. split ( escOpen ) . join ( '{' )
. split ( escClose ) . join ( '}' )
. split ( escComma ) . join ( ',' )
. split ( escPeriod ) . join ( '.' ) ;
}
// Basically just str.split(","), but handling cases
// where we have nested braced sections, which should be
// treated as individual members, like {a,{b,c},d}
function parseCommaParts ( str ) {
if ( ! str )
return [ '' ] ;
var parts = [ ] ;
var m = balanced ( '{' , '}' , str ) ;
if ( ! m )
return str . split ( ',' ) ;
var pre = m . pre ;
var body = m . body ;
var post = m . post ;
var p = pre . split ( ',' ) ;
p [ p . length - 1 ] += '{' + body + '}' ;
var postParts = parseCommaParts ( post ) ;
if ( post . length ) {
p [ p . length - 1 ] += postParts . shift ( ) ;
p . push . apply ( p , postParts ) ;
}
parts . push . apply ( parts , p ) ;
return parts ;
}
function expandTop ( str ) {
if ( ! str )
return [ ] ;
// I don't know why Bash 4.3 does this, but it does.
// Anything starting with {} will have the first two bytes preserved
// but *only* at the top level, so {},a}b will not expand to anything,
// but a{},b}c will be expanded to [a}c,abc].
// One could argue that this is a bug in Bash, but since the goal of
// this module is to match Bash's rules, we escape a leading {}
if ( str . substr ( 0 , 2 ) === '{}' ) {
str = '\\{\\}' + str . substr ( 2 ) ;
}
return expand ( escapeBraces ( str ) , true ) . map ( unescapeBraces ) ;
}
function identity ( e ) {
return e ;
}
function embrace ( str ) {
return '{' + str + '}' ;
}
function isPadded ( el ) {
return /^-?0\d/ . test ( el ) ;
}
function lte ( i , y ) {
return i <= y ;
}
function gte ( i , y ) {
return i >= y ;
}
function expand ( str , isTop ) {
var expansions = [ ] ;
var m = balanced ( '{' , '}' , str ) ;
if ( ! m || /\$$/ . test ( m . pre ) ) return [ str ] ;
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/ . test ( m . body ) ;
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/ . test ( m . body ) ;
var isSequence = isNumericSequence || isAlphaSequence ;
var isOptions = m . body . indexOf ( ',' ) >= 0 ;
if ( ! isSequence && ! isOptions ) {
// {a},b}
if ( m . post . match ( /,.*\}/ ) ) {
str = m . pre + '{' + m . body + escClose + m . post ;
return expand ( str ) ;
}
return [ str ] ;
}
var n ;
if ( isSequence ) {
n = m . body . split ( /\.\./ ) ;
} else {
n = parseCommaParts ( m . body ) ;
if ( n . length === 1 ) {
// x{{a,b}}y ==> x{a}y x{b}y
n = expand ( n [ 0 ] , false ) . map ( embrace ) ;
if ( n . length === 1 ) {
var post = m . post . length
? expand ( m . post , false )
: [ '' ] ;
return post . map ( function ( p ) {
return m . pre + n [ 0 ] + p ;
} ) ;
}
}
}
// at this point, n is the parts, and we know it's not a comma set
// with a single entry.
// no need to expand pre, since it is guaranteed to be free of brace-sets
var pre = m . pre ;
var post = m . post . length
? expand ( m . post , false )
: [ '' ] ;
var N ;
if ( isSequence ) {
var x = numeric ( n [ 0 ] ) ;
var y = numeric ( n [ 1 ] ) ;
var width = Math . max ( n [ 0 ] . length , n [ 1 ] . length )
var incr = n . length == 3
? Math . abs ( numeric ( n [ 2 ] ) )
: 1 ;
var test = lte ;
var reverse = y < x ;
if ( reverse ) {
incr *= - 1 ;
test = gte ;
}
var pad = n . some ( isPadded ) ;
N = [ ] ;
for ( var i = x ; test ( i , y ) ; i += incr ) {
var c ;
if ( isAlphaSequence ) {
c = String . fromCharCode ( i ) ;
if ( c === '\\' )
c = '' ;
} else {
c = String ( i ) ;
if ( pad ) {
var need = width - c . length ;
if ( need > 0 ) {
var z = new Array ( need + 1 ) . join ( '0' ) ;
if ( i < 0 )
c = '-' + z + c . slice ( 1 ) ;
else
c = z + c ;
}
}
}
N . push ( c ) ;
}
} else {
N = concatMap ( n , function ( el ) { return expand ( el , false ) } ) ;
}
for ( var j = 0 ; j < N . length ; j ++ ) {
for ( var k = 0 ; k < post . length ; k ++ ) {
var expansion = pre + N [ j ] + post [ k ] ;
if ( ! isTop || isSequence || expansion )
expansions . push ( expansion ) ;
}
}
return expansions ;
}
/***/ } ) ,
/***/ 327 :
/***/ ( function ( _ _unusedmodule , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
/ * *
* Indicates whether a pattern matches a path
* /
var MatchKind ;
( function ( MatchKind ) {
/** Not matched */
MatchKind [ MatchKind [ "None" ] = 0 ] = "None" ;
/** Matched if the path is a directory */
MatchKind [ MatchKind [ "Directory" ] = 1 ] = "Directory" ;
/** Matched if the path is a regular file */
MatchKind [ MatchKind [ "File" ] = 2 ] = "File" ;
/** Matched */
MatchKind [ MatchKind [ "All" ] = 3 ] = "All" ;
} ) ( MatchKind = exports . MatchKind || ( exports . MatchKind = { } ) ) ;
//# sourceMappingURL=internal-match-kind.js.map
/***/ } ) ,
/***/ 357 :
/***/ ( function ( module ) {
module . exports = require ( "assert" ) ;
/***/ } ) ,
/***/ 369 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _awaiter = ( this && this . _ _awaiter ) || function ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
} ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const core = _ _importStar ( _ _webpack _require _ _ ( 470 ) ) ;
const internal _upload _specification _1 = _ _webpack _require _ _ ( 82 ) ;
const internal _upload _http _client _1 = _ _webpack _require _ _ ( 715 ) ;
const internal _utils _1 = _ _webpack _require _ _ ( 931 ) ;
const internal _download _http _client _1 = _ _webpack _require _ _ ( 130 ) ;
const internal _download _specification _1 = _ _webpack _require _ _ ( 195 ) ;
const internal _config _variables _1 = _ _webpack _require _ _ ( 717 ) ;
const path _1 = _ _webpack _require _ _ ( 622 ) ;
class DefaultArtifactClient {
/ * *
* Constructs a DefaultArtifactClient
* /
static create ( ) {
return new DefaultArtifactClient ( ) ;
}
/ * *
* Uploads an artifact
* /
uploadArtifact ( name , files , rootDirectory , options ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
internal _utils _1 . checkArtifactName ( name ) ;
// Get specification for the files being uploaded
const uploadSpecification = internal _upload _specification _1 . getUploadSpecification ( name , rootDirectory , files ) ;
const uploadResponse = {
artifactName : name ,
artifactItems : [ ] ,
size : 0 ,
failedItems : [ ]
} ;
if ( uploadSpecification . length === 0 ) {
core . warning ( ` No files found that can be uploaded ` ) ;
}
else {
// Create an entry for the artifact in the file container
const response = yield internal _upload _http _client _1 . createArtifactInFileContainer ( name ) ;
if ( ! response . fileContainerResourceUrl ) {
core . debug ( response . toString ( ) ) ;
throw new Error ( 'No URL provided by the Artifact Service to upload an artifact to' ) ;
}
core . debug ( ` Upload Resource URL: ${ response . fileContainerResourceUrl } ` ) ;
// Upload each of the files that were found concurrently
const uploadResult = yield internal _upload _http _client _1 . uploadArtifactToFileContainer ( response . fileContainerResourceUrl , uploadSpecification , options ) ;
//Update the size of the artifact to indicate we are done uploading
yield internal _upload _http _client _1 . patchArtifactSize ( uploadResult . size , name ) ;
core . info ( ` Finished uploading artifact ${ name } . Reported size is ${ uploadResult . size } bytes. There were ${ uploadResult . failedItems . length } items that failed to upload ` ) ;
uploadResponse . artifactItems = uploadSpecification . map ( item => item . absoluteFilePath ) ;
uploadResponse . size = uploadResult . size ;
uploadResponse . failedItems = uploadResult . failedItems ;
}
return uploadResponse ;
} ) ;
}
downloadArtifact ( name , path , options ) {
var _a ;
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const artifacts = yield internal _download _http _client _1 . listArtifacts ( ) ;
if ( artifacts . count === 0 ) {
throw new Error ( ` Unable to find any artifacts for the associated workflow ` ) ;
}
const artifactToDownload = artifacts . value . find ( artifact => {
return artifact . name === name ;
} ) ;
if ( ! artifactToDownload ) {
throw new Error ( ` Unable to find an artifact with the name: ${ name } ` ) ;
}
const items = yield internal _download _http _client _1 . getContainerItems ( artifactToDownload . name , artifactToDownload . fileContainerResourceUrl ) ;
if ( ! path ) {
path = internal _config _variables _1 . getWorkSpaceDirectory ( ) ;
}
path = path _1 . normalize ( path ) ;
path = path _1 . resolve ( path ) ;
// During upload, empty directories are rejected by the remote server so there should be no artifacts that consist of only empty directories
const downloadSpecification = internal _download _specification _1 . getDownloadSpecification ( name , items . value , path , ( ( _a = options ) === null || _a === void 0 ? void 0 : _a . createArtifactFolder ) || false ) ;
if ( downloadSpecification . filesToDownload . length === 0 ) {
core . info ( ` No downloadable files were found for the artifact: ${ artifactToDownload . name } ` ) ;
}
else {
// Create all necessary directories recursively before starting any download
yield internal _utils _1 . createDirectoriesForArtifact ( downloadSpecification . directoryStructure ) ;
yield internal _download _http _client _1 . downloadSingleArtifact ( downloadSpecification . filesToDownload ) ;
}
return {
artifactName : name ,
downloadPath : downloadSpecification . rootDownloadLocation
} ;
} ) ;
}
downloadAllArtifacts ( path ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const response = [ ] ;
const artifacts = yield internal _download _http _client _1 . listArtifacts ( ) ;
if ( artifacts . count === 0 ) {
core . info ( 'Unable to find any artifacts for the associated workflow' ) ;
return response ;
}
if ( ! path ) {
path = internal _config _variables _1 . getWorkSpaceDirectory ( ) ;
}
path = path _1 . normalize ( path ) ;
path = path _1 . resolve ( path ) ;
const ARTIFACT _CONCURRENCY = internal _config _variables _1 . getDownloadArtifactConcurrency ( ) ;
const parallelDownloads = [ ... new Array ( ARTIFACT _CONCURRENCY ) . keys ( ) ] ;
let downloadedArtifacts = 0 ;
yield Promise . all ( parallelDownloads . map ( ( ) => _ _awaiter ( this , void 0 , void 0 , function * ( ) {
while ( downloadedArtifacts < artifacts . count ) {
const currentArtifactToDownload = artifacts . value [ downloadedArtifacts ] ;
downloadedArtifacts += 1 ;
// Get container entries for the specific artifact
const items = yield internal _download _http _client _1 . getContainerItems ( currentArtifactToDownload . name , currentArtifactToDownload . fileContainerResourceUrl ) ;
// Promise.All is not correctly inferring that 'path' is no longer possibly undefined: https://github.com/microsoft/TypeScript/issues/34925
const downloadSpecification = internal _download _specification _1 . getDownloadSpecification ( currentArtifactToDownload . name , items . value , path , // eslint-disable-line @typescript-eslint/no-non-null-assertion
true ) ;
if ( downloadSpecification . filesToDownload . length === 0 ) {
core . info ( ` No downloadable files were found for any artifact ${ currentArtifactToDownload . name } ` ) ;
}
else {
yield internal _utils _1 . createDirectoriesForArtifact ( downloadSpecification . directoryStructure ) ;
yield internal _download _http _client _1 . downloadSingleArtifact ( downloadSpecification . filesToDownload ) ;
}
response . push ( {
artifactName : currentArtifactToDownload . name ,
downloadPath : downloadSpecification . rootDownloadLocation
} ) ;
}
} ) ) ) ;
return response ;
} ) ;
}
}
exports . DefaultArtifactClient = DefaultArtifactClient ;
//# sourceMappingURL=internal-artifact-client.js.map
/***/ } ) ,
/***/ 383 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const assert = _ _webpack _require _ _ ( 357 ) ;
const path = _ _webpack _require _ _ ( 622 ) ;
const pathHelper = _ _webpack _require _ _ ( 972 ) ;
const IS _WINDOWS = process . platform === 'win32' ;
/ * *
* Helper class for parsing paths into segments
* /
class Path {
/ * *
* Constructs a Path
* @ param itemPath Path or array of segments
* /
constructor ( itemPath ) {
this . segments = [ ] ;
// String
if ( typeof itemPath === 'string' ) {
assert ( itemPath , ` Parameter 'itemPath' must not be empty ` ) ;
// Normalize slashes and trim unnecessary trailing slash
itemPath = pathHelper . safeTrimTrailingSeparator ( itemPath ) ;
// Not rooted
if ( ! pathHelper . hasRoot ( itemPath ) ) {
this . segments = itemPath . split ( path . sep ) ;
}
// Rooted
else {
// Add all segments, while not at the root
let remaining = itemPath ;
let dir = pathHelper . dirname ( remaining ) ;
while ( dir !== remaining ) {
// Add the segment
const basename = path . basename ( remaining ) ;
this . segments . unshift ( basename ) ;
// Truncate the last segment
remaining = dir ;
dir = pathHelper . dirname ( remaining ) ;
}
// Remainder is the root
this . segments . unshift ( remaining ) ;
}
}
// Array
else {
// Must not be empty
assert ( itemPath . length > 0 , ` Parameter 'itemPath' must not be an empty array ` ) ;
// Each segment
for ( let i = 0 ; i < itemPath . length ; i ++ ) {
let segment = itemPath [ i ] ;
// Must not be empty
assert ( segment , ` Parameter 'itemPath' must not contain any empty segments ` ) ;
// Normalize slashes
segment = pathHelper . normalizeSeparators ( itemPath [ i ] ) ;
// Root segment
if ( i === 0 && pathHelper . hasRoot ( segment ) ) {
segment = pathHelper . safeTrimTrailingSeparator ( segment ) ;
assert ( segment === pathHelper . dirname ( segment ) , ` Parameter 'itemPath' root segment contains information for multiple segments ` ) ;
this . segments . push ( segment ) ;
}
// All other segments
else {
// Must not contain slash
assert ( ! segment . includes ( path . sep ) , ` Parameter 'itemPath' contains unexpected path separators ` ) ;
this . segments . push ( segment ) ;
}
}
}
}
/ * *
* Converts the path to it ' s string representation
* /
toString ( ) {
// First segment
let result = this . segments [ 0 ] ;
// All others
let skipSlash = result . endsWith ( path . sep ) || ( IS _WINDOWS && /^[A-Z]:$/i . test ( result ) ) ;
for ( let i = 1 ; i < this . segments . length ; i ++ ) {
if ( skipSlash ) {
skipSlash = false ;
}
else {
result += path . sep ;
}
result += this . segments [ i ] ;
}
return result ;
}
}
exports . Path = Path ;
//# sourceMappingURL=internal-path.js.map
/***/ } ) ,
/***/ 385 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _awaiter = ( this && this . _ _awaiter ) || function ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
} ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const core = _ _importStar ( _ _webpack _require _ _ ( 470 ) ) ;
const artifact = _ _importStar ( _ _webpack _require _ _ ( 214 ) ) ;
2020-02-20 22:56:19 -05:00
const constants _1 = _ _webpack _require _ _ ( 694 ) ;
2020-02-20 21:28:14 -05:00
const search _1 = _ _webpack _require _ _ ( 575 ) ;
function run ( ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
try {
2020-02-20 22:56:19 -05:00
const name = core . getInput ( constants _1 . Inputs . Name , { required : false } ) ;
2020-02-20 21:28:14 -05:00
const path = core . getInput ( constants _1 . Inputs . Path , { required : true } ) ;
const searchResult = yield search _1 . findFilesToUpload ( path ) ;
if ( searchResult . filesToUpload . length === 0 ) {
core . warning ( ` No files were found for the provided path: ${ path } . No artifacts will be uploaded. ` ) ;
}
else {
2020-02-20 22:56:19 -05:00
core . info ( ` With the provided path, there will be ${ searchResult . filesToUpload . length } files uploaded ` ) ;
for ( const file of searchResult . filesToUpload ) {
core . debug ( ` Upload file: ${ file } ` ) ;
}
core . debug ( ` Root artifact directory is ${ searchResult . rootDirectory } ` ) ;
2020-02-20 21:28:14 -05:00
const artifactClient = artifact . create ( ) ;
const options = {
continueOnError : true
} ;
yield artifactClient . uploadArtifact ( name || constants _1 . getDefaultArtifactName ( ) , searchResult . filesToUpload , searchResult . rootDirectory , options ) ;
core . info ( 'Artifact upload has finished successfully' ) ;
}
}
catch ( err ) {
core . setFailed ( err . message ) ;
}
} ) ;
}
run ( ) ;
/***/ } ) ,
/***/ 413 :
/***/ ( function ( module , _ _unusedexports , _ _webpack _require _ _ ) {
module . exports = _ _webpack _require _ _ ( 141 ) ;
/***/ } ) ,
/***/ 431 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const os = _ _importStar ( _ _webpack _require _ _ ( 87 ) ) ;
/ * *
* Commands
*
* Command Format :
* : : name key = value , key = value : : message
*
* Examples :
* : : warning : : This is the message
* : : set - env name = MY _VAR : : some value
* /
function issueCommand ( command , properties , message ) {
const cmd = new Command ( command , properties , message ) ;
process . stdout . write ( cmd . toString ( ) + os . EOL ) ;
}
exports . issueCommand = issueCommand ;
function issue ( name , message = '' ) {
issueCommand ( name , { } , message ) ;
}
exports . issue = issue ;
const CMD _STRING = '::' ;
class Command {
constructor ( command , properties , message ) {
if ( ! command ) {
command = 'missing.command' ;
}
this . command = command ;
this . properties = properties ;
this . message = message ;
}
toString ( ) {
let cmdStr = CMD _STRING + this . command ;
if ( this . properties && Object . keys ( this . properties ) . length > 0 ) {
cmdStr += ' ' ;
let first = true ;
for ( const key in this . properties ) {
if ( this . properties . hasOwnProperty ( key ) ) {
const val = this . properties [ key ] ;
if ( val ) {
if ( first ) {
first = false ;
}
else {
cmdStr += ',' ;
}
cmdStr += ` ${ key } = ${ escapeProperty ( val ) } ` ;
}
}
}
}
cmdStr += ` ${ CMD _STRING } ${ escapeData ( this . message ) } ` ;
return cmdStr ;
}
}
function escapeData ( s ) {
return ( s || '' )
. replace ( /%/g , '%25' )
. replace ( /\r/g , '%0D' )
. replace ( /\n/g , '%0A' ) ;
}
function escapeProperty ( s ) {
return ( s || '' )
. replace ( /%/g , '%25' )
. replace ( /\r/g , '%0D' )
. replace ( /\n/g , '%0A' )
. replace ( /:/g , '%3A' )
. replace ( /,/g , '%2C' ) ;
}
//# sourceMappingURL=command.js.map
/***/ } ) ,
/***/ 470 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _awaiter = ( this && this . _ _awaiter ) || function ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
} ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const command _1 = _ _webpack _require _ _ ( 431 ) ;
const os = _ _importStar ( _ _webpack _require _ _ ( 87 ) ) ;
const path = _ _importStar ( _ _webpack _require _ _ ( 622 ) ) ;
/ * *
* The code to exit an action
* /
var ExitCode ;
( function ( ExitCode ) {
/ * *
* A code indicating that the action was successful
* /
ExitCode [ ExitCode [ "Success" ] = 0 ] = "Success" ;
/ * *
* A code indicating that the action was a failure
* /
ExitCode [ ExitCode [ "Failure" ] = 1 ] = "Failure" ;
} ) ( ExitCode = exports . ExitCode || ( exports . ExitCode = { } ) ) ;
//-----------------------------------------------------------------------
// Variables
//-----------------------------------------------------------------------
/ * *
* Sets env variable for this action and future actions in the job
* @ param name the name of the variable to set
* @ param val the value of the variable
* /
function exportVariable ( name , val ) {
process . env [ name ] = val ;
command _1 . issueCommand ( 'set-env' , { name } , val ) ;
}
exports . exportVariable = exportVariable ;
/ * *
* Registers a secret which will get masked from logs
* @ param secret value of the secret
* /
function setSecret ( secret ) {
command _1 . issueCommand ( 'add-mask' , { } , secret ) ;
}
exports . setSecret = setSecret ;
/ * *
* Prepends inputPath to the PATH ( for this action and future actions )
* @ param inputPath
* /
function addPath ( inputPath ) {
command _1 . issueCommand ( 'add-path' , { } , inputPath ) ;
process . env [ 'PATH' ] = ` ${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
}
exports . addPath = addPath ;
/ * *
* Gets the value of an input . The value is also trimmed .
*
* @ param name name of the input to get
* @ param options optional . See InputOptions .
* @ returns string
* /
function getInput ( name , options ) {
const val = process . env [ ` INPUT_ ${ name . replace ( / /g , '_' ) . toUpperCase ( ) } ` ] || '' ;
if ( options && options . required && ! val ) {
throw new Error ( ` Input required and not supplied: ${ name } ` ) ;
}
return val . trim ( ) ;
}
exports . getInput = getInput ;
/ * *
* Sets the value of an output .
*
* @ param name name of the output to set
* @ param value value to store
* /
function setOutput ( name , value ) {
command _1 . issueCommand ( 'set-output' , { name } , value ) ;
}
exports . setOutput = setOutput ;
//-----------------------------------------------------------------------
// Results
//-----------------------------------------------------------------------
/ * *
* Sets the action status to failed .
* When the action exits it will be with an exit code of 1
* @ param message add error issue message
* /
function setFailed ( message ) {
process . exitCode = ExitCode . Failure ;
error ( message ) ;
}
exports . setFailed = setFailed ;
//-----------------------------------------------------------------------
// Logging Commands
//-----------------------------------------------------------------------
/ * *
* Writes debug message to user log
* @ param message debug message
* /
function debug ( message ) {
command _1 . issueCommand ( 'debug' , { } , message ) ;
}
exports . debug = debug ;
/ * *
* Adds an error issue
* @ param message error issue message
* /
function error ( message ) {
command _1 . issue ( 'error' , message ) ;
}
exports . error = error ;
/ * *
* Adds an warning issue
* @ param message warning issue message
* /
function warning ( message ) {
command _1 . issue ( 'warning' , message ) ;
}
exports . warning = warning ;
/ * *
* Writes info to log with console . log .
* @ param message info message
* /
function info ( message ) {
process . stdout . write ( message + os . EOL ) ;
}
exports . info = info ;
/ * *
* Begin an output group .
*
* Output until the next ` groupEnd ` will be foldable in this group
*
* @ param name The name of the output group
* /
function startGroup ( name ) {
command _1 . issue ( 'group' , name ) ;
}
exports . startGroup = startGroup ;
/ * *
* End an output group .
* /
function endGroup ( ) {
command _1 . issue ( 'endgroup' ) ;
}
exports . endGroup = endGroup ;
/ * *
* Wrap an asynchronous function call in a group .
*
* Returns the same type as the function itself .
*
* @ param name The name of the group
* @ param fn The function to wrap in the group
* /
function group ( name , fn ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
startGroup ( name ) ;
let result ;
try {
result = yield fn ( ) ;
}
finally {
endGroup ( ) ;
}
return result ;
} ) ;
}
exports . group = group ;
//-----------------------------------------------------------------------
// Wrapper action state
//-----------------------------------------------------------------------
/ * *
* Saves state for current action , the state can only be retrieved by this action ' s post job execution .
*
* @ param name name of the state to store
* @ param value value to store
* /
function saveState ( name , value ) {
command _1 . issueCommand ( 'save-state' , { name } , value ) ;
}
exports . saveState = saveState ;
/ * *
* Gets the value of an state set by this action ' s main execution .
*
* @ param name name of the state to get
* @ returns string
* /
function getState ( name ) {
return process . env [ ` STATE_ ${ name } ` ] || '' ;
}
exports . getState = getState ;
//# sourceMappingURL=core.js.map
/***/ } ) ,
/***/ 539 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const url = _ _webpack _require _ _ ( 835 ) ;
const http = _ _webpack _require _ _ ( 605 ) ;
const https = _ _webpack _require _ _ ( 211 ) ;
const pm = _ _webpack _require _ _ ( 950 ) ;
let tunnel ;
var HttpCodes ;
( function ( HttpCodes ) {
HttpCodes [ HttpCodes [ "OK" ] = 200 ] = "OK" ;
HttpCodes [ HttpCodes [ "MultipleChoices" ] = 300 ] = "MultipleChoices" ;
HttpCodes [ HttpCodes [ "MovedPermanently" ] = 301 ] = "MovedPermanently" ;
HttpCodes [ HttpCodes [ "ResourceMoved" ] = 302 ] = "ResourceMoved" ;
HttpCodes [ HttpCodes [ "SeeOther" ] = 303 ] = "SeeOther" ;
HttpCodes [ HttpCodes [ "NotModified" ] = 304 ] = "NotModified" ;
HttpCodes [ HttpCodes [ "UseProxy" ] = 305 ] = "UseProxy" ;
HttpCodes [ HttpCodes [ "SwitchProxy" ] = 306 ] = "SwitchProxy" ;
HttpCodes [ HttpCodes [ "TemporaryRedirect" ] = 307 ] = "TemporaryRedirect" ;
HttpCodes [ HttpCodes [ "PermanentRedirect" ] = 308 ] = "PermanentRedirect" ;
HttpCodes [ HttpCodes [ "BadRequest" ] = 400 ] = "BadRequest" ;
HttpCodes [ HttpCodes [ "Unauthorized" ] = 401 ] = "Unauthorized" ;
HttpCodes [ HttpCodes [ "PaymentRequired" ] = 402 ] = "PaymentRequired" ;
HttpCodes [ HttpCodes [ "Forbidden" ] = 403 ] = "Forbidden" ;
HttpCodes [ HttpCodes [ "NotFound" ] = 404 ] = "NotFound" ;
HttpCodes [ HttpCodes [ "MethodNotAllowed" ] = 405 ] = "MethodNotAllowed" ;
HttpCodes [ HttpCodes [ "NotAcceptable" ] = 406 ] = "NotAcceptable" ;
HttpCodes [ HttpCodes [ "ProxyAuthenticationRequired" ] = 407 ] = "ProxyAuthenticationRequired" ;
HttpCodes [ HttpCodes [ "RequestTimeout" ] = 408 ] = "RequestTimeout" ;
HttpCodes [ HttpCodes [ "Conflict" ] = 409 ] = "Conflict" ;
HttpCodes [ HttpCodes [ "Gone" ] = 410 ] = "Gone" ;
HttpCodes [ HttpCodes [ "InternalServerError" ] = 500 ] = "InternalServerError" ;
HttpCodes [ HttpCodes [ "NotImplemented" ] = 501 ] = "NotImplemented" ;
HttpCodes [ HttpCodes [ "BadGateway" ] = 502 ] = "BadGateway" ;
HttpCodes [ HttpCodes [ "ServiceUnavailable" ] = 503 ] = "ServiceUnavailable" ;
HttpCodes [ HttpCodes [ "GatewayTimeout" ] = 504 ] = "GatewayTimeout" ;
} ) ( HttpCodes = exports . HttpCodes || ( exports . HttpCodes = { } ) ) ;
var Headers ;
( function ( Headers ) {
Headers [ "Accept" ] = "accept" ;
Headers [ "ContentType" ] = "content-type" ;
} ) ( Headers = exports . Headers || ( exports . Headers = { } ) ) ;
var MediaTypes ;
( function ( MediaTypes ) {
MediaTypes [ "ApplicationJson" ] = "application/json" ;
} ) ( MediaTypes = exports . MediaTypes || ( exports . MediaTypes = { } ) ) ;
/ * *
* Returns the proxy URL , depending upon the supplied url and proxy environment variables .
* @ param serverUrl The server URL where the request will be sent . For example , https : //api.github.com
* /
function getProxyUrl ( serverUrl ) {
let proxyUrl = pm . getProxyUrl ( url . parse ( serverUrl ) ) ;
return proxyUrl ? proxyUrl . href : '' ;
}
exports . getProxyUrl = getProxyUrl ;
const HttpRedirectCodes = [ HttpCodes . MovedPermanently , HttpCodes . ResourceMoved , HttpCodes . SeeOther , HttpCodes . TemporaryRedirect , HttpCodes . PermanentRedirect ] ;
const HttpResponseRetryCodes = [ HttpCodes . BadGateway , HttpCodes . ServiceUnavailable , HttpCodes . GatewayTimeout ] ;
const RetryableHttpVerbs = [ 'OPTIONS' , 'GET' , 'DELETE' , 'HEAD' ] ;
const ExponentialBackoffCeiling = 10 ;
const ExponentialBackoffTimeSlice = 5 ;
class HttpClientResponse {
constructor ( message ) {
this . message = message ;
}
readBody ( ) {
return new Promise ( async ( resolve , reject ) => {
let output = Buffer . alloc ( 0 ) ;
this . message . on ( 'data' , ( chunk ) => {
output = Buffer . concat ( [ output , chunk ] ) ;
} ) ;
this . message . on ( 'end' , ( ) => {
resolve ( output . toString ( ) ) ;
} ) ;
} ) ;
}
}
exports . HttpClientResponse = HttpClientResponse ;
function isHttps ( requestUrl ) {
let parsedUrl = url . parse ( requestUrl ) ;
return parsedUrl . protocol === 'https:' ;
}
exports . isHttps = isHttps ;
class HttpClient {
constructor ( userAgent , handlers , requestOptions ) {
this . _ignoreSslError = false ;
this . _allowRedirects = true ;
this . _allowRedirectDowngrade = false ;
this . _maxRedirects = 50 ;
this . _allowRetries = false ;
this . _maxRetries = 1 ;
this . _keepAlive = false ;
this . _disposed = false ;
this . userAgent = userAgent ;
this . handlers = handlers || [ ] ;
this . requestOptions = requestOptions ;
if ( requestOptions ) {
if ( requestOptions . ignoreSslError != null ) {
this . _ignoreSslError = requestOptions . ignoreSslError ;
}
this . _socketTimeout = requestOptions . socketTimeout ;
if ( requestOptions . allowRedirects != null ) {
this . _allowRedirects = requestOptions . allowRedirects ;
}
if ( requestOptions . allowRedirectDowngrade != null ) {
this . _allowRedirectDowngrade = requestOptions . allowRedirectDowngrade ;
}
if ( requestOptions . maxRedirects != null ) {
this . _maxRedirects = Math . max ( requestOptions . maxRedirects , 0 ) ;
}
if ( requestOptions . keepAlive != null ) {
this . _keepAlive = requestOptions . keepAlive ;
}
if ( requestOptions . allowRetries != null ) {
this . _allowRetries = requestOptions . allowRetries ;
}
if ( requestOptions . maxRetries != null ) {
this . _maxRetries = requestOptions . maxRetries ;
}
}
}
options ( requestUrl , additionalHeaders ) {
return this . request ( 'OPTIONS' , requestUrl , null , additionalHeaders || { } ) ;
}
get ( requestUrl , additionalHeaders ) {
return this . request ( 'GET' , requestUrl , null , additionalHeaders || { } ) ;
}
del ( requestUrl , additionalHeaders ) {
return this . request ( 'DELETE' , requestUrl , null , additionalHeaders || { } ) ;
}
post ( requestUrl , data , additionalHeaders ) {
return this . request ( 'POST' , requestUrl , data , additionalHeaders || { } ) ;
}
patch ( requestUrl , data , additionalHeaders ) {
return this . request ( 'PATCH' , requestUrl , data , additionalHeaders || { } ) ;
}
put ( requestUrl , data , additionalHeaders ) {
return this . request ( 'PUT' , requestUrl , data , additionalHeaders || { } ) ;
}
head ( requestUrl , additionalHeaders ) {
return this . request ( 'HEAD' , requestUrl , null , additionalHeaders || { } ) ;
}
sendStream ( verb , requestUrl , stream , additionalHeaders ) {
return this . request ( verb , requestUrl , stream , additionalHeaders ) ;
}
/ * *
* Gets a typed object from an endpoint
* Be aware that not found returns a null . Other errors ( 4 xx , 5 xx ) reject the promise
* /
async getJson ( requestUrl , additionalHeaders = { } ) {
additionalHeaders [ Headers . Accept ] = this . _getExistingOrDefaultHeader ( additionalHeaders , Headers . Accept , MediaTypes . ApplicationJson ) ;
let res = await this . get ( requestUrl , additionalHeaders ) ;
return this . _processResponse ( res , this . requestOptions ) ;
}
async postJson ( requestUrl , obj , additionalHeaders = { } ) {
let data = JSON . stringify ( obj , null , 2 ) ;
additionalHeaders [ Headers . Accept ] = this . _getExistingOrDefaultHeader ( additionalHeaders , Headers . Accept , MediaTypes . ApplicationJson ) ;
additionalHeaders [ Headers . ContentType ] = this . _getExistingOrDefaultHeader ( additionalHeaders , Headers . ContentType , MediaTypes . ApplicationJson ) ;
let res = await this . post ( requestUrl , data , additionalHeaders ) ;
return this . _processResponse ( res , this . requestOptions ) ;
}
async putJson ( requestUrl , obj , additionalHeaders = { } ) {
let data = JSON . stringify ( obj , null , 2 ) ;
additionalHeaders [ Headers . Accept ] = this . _getExistingOrDefaultHeader ( additionalHeaders , Headers . Accept , MediaTypes . ApplicationJson ) ;
additionalHeaders [ Headers . ContentType ] = this . _getExistingOrDefaultHeader ( additionalHeaders , Headers . ContentType , MediaTypes . ApplicationJson ) ;
let res = await this . put ( requestUrl , data , additionalHeaders ) ;
return this . _processResponse ( res , this . requestOptions ) ;
}
async patchJson ( requestUrl , obj , additionalHeaders = { } ) {
let data = JSON . stringify ( obj , null , 2 ) ;
additionalHeaders [ Headers . Accept ] = this . _getExistingOrDefaultHeader ( additionalHeaders , Headers . Accept , MediaTypes . ApplicationJson ) ;
additionalHeaders [ Headers . ContentType ] = this . _getExistingOrDefaultHeader ( additionalHeaders , Headers . ContentType , MediaTypes . ApplicationJson ) ;
let res = await this . patch ( requestUrl , data , additionalHeaders ) ;
return this . _processResponse ( res , this . requestOptions ) ;
}
/ * *
* Makes a raw http request .
* All other methods such as get , post , patch , and request ultimately call this .
* Prefer get , del , post and patch
* /
async request ( verb , requestUrl , data , headers ) {
if ( this . _disposed ) {
throw new Error ( "Client has already been disposed." ) ;
}
let parsedUrl = url . parse ( requestUrl ) ;
let info = this . _prepareRequest ( verb , parsedUrl , headers ) ;
// Only perform retries on reads since writes may not be idempotent.
let maxTries = ( this . _allowRetries && RetryableHttpVerbs . indexOf ( verb ) != - 1 ) ? this . _maxRetries + 1 : 1 ;
let numTries = 0 ;
let response ;
while ( numTries < maxTries ) {
response = await this . requestRaw ( info , data ) ;
// Check if it's an authentication challenge
if ( response && response . message && response . message . statusCode === HttpCodes . Unauthorized ) {
let authenticationHandler ;
for ( let i = 0 ; i < this . handlers . length ; i ++ ) {
if ( this . handlers [ i ] . canHandleAuthentication ( response ) ) {
authenticationHandler = this . handlers [ i ] ;
break ;
}
}
if ( authenticationHandler ) {
return authenticationHandler . handleAuthentication ( this , info , data ) ;
}
else {
// We have received an unauthorized response but have no handlers to handle it.
// Let the response return to the caller.
return response ;
}
}
let redirectsRemaining = this . _maxRedirects ;
while ( HttpRedirectCodes . indexOf ( response . message . statusCode ) != - 1
&& this . _allowRedirects
&& redirectsRemaining > 0 ) {
const redirectUrl = response . message . headers [ "location" ] ;
if ( ! redirectUrl ) {
// if there's no location to redirect to, we won't
break ;
}
let parsedRedirectUrl = url . parse ( redirectUrl ) ;
if ( parsedUrl . protocol == 'https:' && parsedUrl . protocol != parsedRedirectUrl . protocol && ! this . _allowRedirectDowngrade ) {
throw new Error ( "Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true." ) ;
}
// we need to finish reading the response before reassigning response
// which will leak the open socket.
await response . readBody ( ) ;
// let's make the request with the new redirectUrl
info = this . _prepareRequest ( verb , parsedRedirectUrl , headers ) ;
response = await this . requestRaw ( info , data ) ;
redirectsRemaining -- ;
}
if ( HttpResponseRetryCodes . indexOf ( response . message . statusCode ) == - 1 ) {
// If not a retry code, return immediately instead of retrying
return response ;
}
numTries += 1 ;
if ( numTries < maxTries ) {
await response . readBody ( ) ;
await this . _performExponentialBackoff ( numTries ) ;
}
}
return response ;
}
/ * *
* Needs to be called if keepAlive is set to true in request options .
* /
dispose ( ) {
if ( this . _agent ) {
this . _agent . destroy ( ) ;
}
this . _disposed = true ;
}
/ * *
* Raw request .
* @ param info
* @ param data
* /
requestRaw ( info , data ) {
return new Promise ( ( resolve , reject ) => {
let callbackForResult = function ( err , res ) {
if ( err ) {
reject ( err ) ;
}
resolve ( res ) ;
} ;
this . requestRawWithCallback ( info , data , callbackForResult ) ;
} ) ;
}
/ * *
* Raw request with callback .
* @ param info
* @ param data
* @ param onResult
* /
requestRawWithCallback ( info , data , onResult ) {
let socket ;
if ( typeof ( data ) === 'string' ) {
info . options . headers [ "Content-Length" ] = Buffer . byteLength ( data , 'utf8' ) ;
}
let callbackCalled = false ;
let handleResult = ( err , res ) => {
if ( ! callbackCalled ) {
callbackCalled = true ;
onResult ( err , res ) ;
}
} ;
let req = info . httpModule . request ( info . options , ( msg ) => {
let res = new HttpClientResponse ( msg ) ;
handleResult ( null , res ) ;
} ) ;
req . on ( 'socket' , ( sock ) => {
socket = sock ;
} ) ;
// If we ever get disconnected, we want the socket to timeout eventually
req . setTimeout ( this . _socketTimeout || 3 * 60000 , ( ) => {
if ( socket ) {
socket . end ( ) ;
}
handleResult ( new Error ( 'Request timeout: ' + info . options . path ) , null ) ;
} ) ;
req . on ( 'error' , function ( err ) {
// err has statusCode property
// res should have headers
handleResult ( err , null ) ;
} ) ;
if ( data && typeof ( data ) === 'string' ) {
req . write ( data , 'utf8' ) ;
}
if ( data && typeof ( data ) !== 'string' ) {
data . on ( 'close' , function ( ) {
req . end ( ) ;
} ) ;
data . pipe ( req ) ;
}
else {
req . end ( ) ;
}
}
/ * *
* Gets an http agent . This function is useful when you need an http agent that handles
* routing through a proxy server - depending upon the url and proxy environment variables .
* @ param serverUrl The server URL where the request will be sent . For example , https : //api.github.com
* /
getAgent ( serverUrl ) {
let parsedUrl = url . parse ( serverUrl ) ;
return this . _getAgent ( parsedUrl ) ;
}
_prepareRequest ( method , requestUrl , headers ) {
const info = { } ;
info . parsedUrl = requestUrl ;
const usingSsl = info . parsedUrl . protocol === 'https:' ;
info . httpModule = usingSsl ? https : http ;
const defaultPort = usingSsl ? 443 : 80 ;
info . options = { } ;
info . options . host = info . parsedUrl . hostname ;
info . options . port = info . parsedUrl . port ? parseInt ( info . parsedUrl . port ) : defaultPort ;
info . options . path = ( info . parsedUrl . pathname || '' ) + ( info . parsedUrl . search || '' ) ;
info . options . method = method ;
info . options . headers = this . _mergeHeaders ( headers ) ;
if ( this . userAgent != null ) {
info . options . headers [ "user-agent" ] = this . userAgent ;
}
info . options . agent = this . _getAgent ( info . parsedUrl ) ;
// gives handlers an opportunity to participate
if ( this . handlers ) {
this . handlers . forEach ( ( handler ) => {
handler . prepareRequest ( info . options ) ;
} ) ;
}
return info ;
}
_mergeHeaders ( headers ) {
const lowercaseKeys = obj => Object . keys ( obj ) . reduce ( ( c , k ) => ( c [ k . toLowerCase ( ) ] = obj [ k ] , c ) , { } ) ;
if ( this . requestOptions && this . requestOptions . headers ) {
return Object . assign ( { } , lowercaseKeys ( this . requestOptions . headers ) , lowercaseKeys ( headers ) ) ;
}
return lowercaseKeys ( headers || { } ) ;
}
_getExistingOrDefaultHeader ( additionalHeaders , header , _default ) {
const lowercaseKeys = obj => Object . keys ( obj ) . reduce ( ( c , k ) => ( c [ k . toLowerCase ( ) ] = obj [ k ] , c ) , { } ) ;
let clientHeader ;
if ( this . requestOptions && this . requestOptions . headers ) {
clientHeader = lowercaseKeys ( this . requestOptions . headers ) [ header ] ;
}
return additionalHeaders [ header ] || clientHeader || _default ;
}
_getAgent ( parsedUrl ) {
let agent ;
let proxyUrl = pm . getProxyUrl ( parsedUrl ) ;
let useProxy = proxyUrl && proxyUrl . hostname ;
if ( this . _keepAlive && useProxy ) {
agent = this . _proxyAgent ;
}
if ( this . _keepAlive && ! useProxy ) {
agent = this . _agent ;
}
// if agent is already assigned use that agent.
if ( ! ! agent ) {
return agent ;
}
const usingSsl = parsedUrl . protocol === 'https:' ;
let maxSockets = 100 ;
if ( ! ! this . requestOptions ) {
maxSockets = this . requestOptions . maxSockets || http . globalAgent . maxSockets ;
}
if ( useProxy ) {
// If using proxy, need tunnel
if ( ! tunnel ) {
tunnel = _ _webpack _require _ _ ( 413 ) ;
}
const agentOptions = {
maxSockets : maxSockets ,
keepAlive : this . _keepAlive ,
proxy : {
proxyAuth : proxyUrl . auth ,
host : proxyUrl . hostname ,
port : proxyUrl . port
} ,
} ;
let tunnelAgent ;
const overHttps = proxyUrl . protocol === 'https:' ;
if ( usingSsl ) {
tunnelAgent = overHttps ? tunnel . httpsOverHttps : tunnel . httpsOverHttp ;
}
else {
tunnelAgent = overHttps ? tunnel . httpOverHttps : tunnel . httpOverHttp ;
}
agent = tunnelAgent ( agentOptions ) ;
this . _proxyAgent = agent ;
}
// if reusing agent across request and tunneling agent isn't assigned create a new agent
if ( this . _keepAlive && ! agent ) {
const options = { keepAlive : this . _keepAlive , maxSockets : maxSockets } ;
agent = usingSsl ? new https . Agent ( options ) : new http . Agent ( options ) ;
this . _agent = agent ;
}
// if not using private agent and tunnel agent isn't setup then use global agent
if ( ! agent ) {
agent = usingSsl ? https . globalAgent : http . globalAgent ;
}
if ( usingSsl && this . _ignoreSslError ) {
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
// we have to cast it to any and change it directly
agent . options = Object . assign ( agent . options || { } , { rejectUnauthorized : false } ) ;
}
return agent ;
}
_performExponentialBackoff ( retryNumber ) {
retryNumber = Math . min ( ExponentialBackoffCeiling , retryNumber ) ;
const ms = ExponentialBackoffTimeSlice * Math . pow ( 2 , retryNumber ) ;
return new Promise ( resolve => setTimeout ( ( ) => resolve ( ) , ms ) ) ;
}
static dateTimeDeserializer ( key , value ) {
if ( typeof value === 'string' ) {
let a = new Date ( value ) ;
if ( ! isNaN ( a . valueOf ( ) ) ) {
return a ;
}
}
return value ;
}
async _processResponse ( res , options ) {
return new Promise ( async ( resolve , reject ) => {
const statusCode = res . message . statusCode ;
const response = {
statusCode : statusCode ,
result : null ,
headers : { }
} ;
// not found leads to null obj returned
if ( statusCode == HttpCodes . NotFound ) {
resolve ( response ) ;
}
let obj ;
let contents ;
// get the result from the body
try {
contents = await res . readBody ( ) ;
if ( contents && contents . length > 0 ) {
if ( options && options . deserializeDates ) {
obj = JSON . parse ( contents , HttpClient . dateTimeDeserializer ) ;
}
else {
obj = JSON . parse ( contents ) ;
}
response . result = obj ;
}
response . headers = res . message . headers ;
}
catch ( err ) {
// Invalid resource (contents not json); leaving result obj null
}
// note that 3xx redirects are handled by the http layer.
if ( statusCode > 299 ) {
let msg ;
// if exception/error in body, attempt to get better error
if ( obj && obj . message ) {
msg = obj . message ;
}
else if ( contents && contents . length > 0 ) {
// it may be the case that the exception is in the body message as string
msg = contents ;
}
else {
msg = "Failed request: (" + statusCode + ")" ;
}
let err = new Error ( msg ) ;
// attach statusCode and body obj (if available) to the error object
err [ 'statusCode' ] = statusCode ;
if ( response . result ) {
err [ 'result' ] = response . result ;
}
reject ( err ) ;
}
else {
resolve ( response ) ;
}
} ) ;
}
}
exports . HttpClient = HttpClient ;
/***/ } ) ,
/***/ 575 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _awaiter = ( this && this . _ _awaiter ) || function ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
} ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const glob = _ _importStar ( _ _webpack _require _ _ ( 281 ) ) ;
const core _1 = _ _webpack _require _ _ ( 470 ) ;
const fs _1 = _ _webpack _require _ _ ( 747 ) ;
const path _1 = _ _webpack _require _ _ ( 622 ) ;
function getDefaultGlobOptions ( ) {
return {
followSymbolicLinks : true ,
implicitDescendants : true ,
omitBrokenSymbolicLinks : true
} ;
}
function findFilesToUpload ( searchPath , globOptions ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const searchResults = [ ] ;
const globber = yield glob . create ( searchPath , globOptions || getDefaultGlobOptions ( ) ) ;
const rawSearchResults = yield globber . glob ( ) ;
/ *
Directories will be rejected if attempted to be uploaded . This includes just empty
directories so filter any directories out from the raw search results
* /
for ( const searchResult of rawSearchResults ) {
if ( ! fs _1 . lstatSync ( searchResult ) . isDirectory ( ) ) {
core _1 . debug ( ` File: ${ searchResult } was found using the provided searchPath ` ) ;
searchResults . push ( searchResult ) ;
}
else {
core _1 . debug ( ` Removing ${ searchResult } from rawSearchResults because it is a directory ` ) ;
}
}
/ *
Only a single search pattern is being included so only 1 searchResult is expected . In the future if multiple search patterns are
simultaneously supported this will change
* /
const searchPaths = globber . getSearchPaths ( ) ;
if ( searchPaths . length > 1 ) {
throw new Error ( 'Only 1 search path should be returned' ) ;
}
/ *
Special case for a single file artifact that is uploaded without a directory or wildcard pattern . The directory structure is
not preserved and the root directory will be the single files parent directory
* /
if ( searchResults . length === 1 && searchPaths [ 0 ] === searchResults [ 0 ] ) {
return {
filesToUpload : searchResults ,
rootDirectory : path _1 . dirname ( searchResults [ 0 ] )
} ;
}
return {
filesToUpload : searchResults ,
rootDirectory : searchPaths [ 0 ]
} ;
} ) ;
}
exports . findFilesToUpload = findFilesToUpload ;
/***/ } ) ,
/***/ 597 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const pathHelper = _ _webpack _require _ _ ( 972 ) ;
const internal _match _kind _1 = _ _webpack _require _ _ ( 327 ) ;
const IS _WINDOWS = process . platform === 'win32' ;
/ * *
* Given an array of patterns , returns an array of paths to search .
* Duplicates and paths under other included paths are filtered out .
* /
function getSearchPaths ( patterns ) {
// Ignore negate patterns
patterns = patterns . filter ( x => ! x . negate ) ;
// Create a map of all search paths
const searchPathMap = { } ;
for ( const pattern of patterns ) {
const key = IS _WINDOWS
? pattern . searchPath . toUpperCase ( )
: pattern . searchPath ;
searchPathMap [ key ] = 'candidate' ;
}
const result = [ ] ;
for ( const pattern of patterns ) {
// Check if already included
const key = IS _WINDOWS
? pattern . searchPath . toUpperCase ( )
: pattern . searchPath ;
if ( searchPathMap [ key ] === 'included' ) {
continue ;
}
// Check for an ancestor search path
let foundAncestor = false ;
let tempKey = key ;
let parent = pathHelper . dirname ( tempKey ) ;
while ( parent !== tempKey ) {
if ( searchPathMap [ parent ] ) {
foundAncestor = true ;
break ;
}
tempKey = parent ;
parent = pathHelper . dirname ( tempKey ) ;
}
// Include the search pattern in the result
if ( ! foundAncestor ) {
result . push ( pattern . searchPath ) ;
searchPathMap [ key ] = 'included' ;
}
}
return result ;
}
exports . getSearchPaths = getSearchPaths ;
/ * *
* Matches the patterns against the path
* /
function match ( patterns , itemPath ) {
let result = internal _match _kind _1 . MatchKind . None ;
for ( const pattern of patterns ) {
if ( pattern . negate ) {
result &= ~ pattern . match ( itemPath ) ;
}
else {
result |= pattern . match ( itemPath ) ;
}
}
return result ;
}
exports . match = match ;
/ * *
* Checks whether to descend further into the directory
* /
function partialMatch ( patterns , itemPath ) {
return patterns . some ( x => ! x . negate && x . partialMatch ( itemPath ) ) ;
}
exports . partialMatch = partialMatch ;
//# sourceMappingURL=internal-pattern-helper.js.map
/***/ } ) ,
/***/ 601 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const core = _ _webpack _require _ _ ( 470 ) ;
/ * *
* Returns a copy with defaults filled in .
* /
function getOptions ( copy ) {
const result = {
followSymbolicLinks : true ,
implicitDescendants : true ,
omitBrokenSymbolicLinks : true
} ;
if ( copy ) {
if ( typeof copy . followSymbolicLinks === 'boolean' ) {
result . followSymbolicLinks = copy . followSymbolicLinks ;
core . debug ( ` followSymbolicLinks ' ${ result . followSymbolicLinks } ' ` ) ;
}
if ( typeof copy . implicitDescendants === 'boolean' ) {
result . implicitDescendants = copy . implicitDescendants ;
core . debug ( ` implicitDescendants ' ${ result . implicitDescendants } ' ` ) ;
}
if ( typeof copy . omitBrokenSymbolicLinks === 'boolean' ) {
result . omitBrokenSymbolicLinks = copy . omitBrokenSymbolicLinks ;
core . debug ( ` omitBrokenSymbolicLinks ' ${ result . omitBrokenSymbolicLinks } ' ` ) ;
}
}
return result ;
}
exports . getOptions = getOptions ;
//# sourceMappingURL=internal-glob-options-helper.js.map
/***/ } ) ,
/***/ 605 :
/***/ ( function ( module ) {
module . exports = require ( "http" ) ;
/***/ } ) ,
/***/ 614 :
/***/ ( function ( module ) {
module . exports = require ( "events" ) ;
/***/ } ) ,
/***/ 621 :
/***/ ( function ( module ) {
"use strict" ;
module . exports = balanced ;
function balanced ( a , b , str ) {
if ( a instanceof RegExp ) a = maybeMatch ( a , str ) ;
if ( b instanceof RegExp ) b = maybeMatch ( b , str ) ;
var r = range ( a , b , str ) ;
return r && {
start : r [ 0 ] ,
end : r [ 1 ] ,
pre : str . slice ( 0 , r [ 0 ] ) ,
body : str . slice ( r [ 0 ] + a . length , r [ 1 ] ) ,
post : str . slice ( r [ 1 ] + b . length )
} ;
}
function maybeMatch ( reg , str ) {
var m = str . match ( reg ) ;
return m ? m [ 0 ] : null ;
}
balanced . range = range ;
function range ( a , b , str ) {
var begs , beg , left , right , result ;
var ai = str . indexOf ( a ) ;
var bi = str . indexOf ( b , ai + 1 ) ;
var i = ai ;
if ( ai >= 0 && bi > 0 ) {
begs = [ ] ;
left = str . length ;
while ( i >= 0 && ! result ) {
if ( i == ai ) {
begs . push ( i ) ;
ai = str . indexOf ( a , i + 1 ) ;
} else if ( begs . length == 1 ) {
result = [ begs . pop ( ) , bi ] ;
} else {
beg = begs . pop ( ) ;
if ( beg < left ) {
left = beg ;
right = bi ;
}
bi = str . indexOf ( b , i + 1 ) ;
}
i = ai < bi && ai >= 0 ? ai : bi ;
}
if ( begs . length ) {
result = [ left , right ] ;
}
}
return result ;
}
/***/ } ) ,
/***/ 622 :
/***/ ( function ( module ) {
module . exports = require ( "path" ) ;
/***/ } ) ,
/***/ 631 :
/***/ ( function ( module ) {
module . exports = require ( "net" ) ;
/***/ } ) ,
/***/ 669 :
/***/ ( function ( module ) {
module . exports = require ( "util" ) ;
/***/ } ) ,
/***/ 694 :
/***/ ( function ( _ _unusedmodule , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
var Inputs ;
( function ( Inputs ) {
Inputs [ "Name" ] = "name" ;
Inputs [ "Path" ] = "path" ;
} ) ( Inputs = exports . Inputs || ( exports . Inputs = { } ) ) ;
function getDefaultArtifactName ( ) {
return 'artifact' ;
}
exports . getDefaultArtifactName = getDefaultArtifactName ;
/***/ } ) ,
/***/ 715 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _awaiter = ( this && this . _ _awaiter ) || function ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
} ;
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const core _1 = _ _webpack _require _ _ ( 470 ) ;
const fs = _ _importStar ( _ _webpack _require _ _ ( 747 ) ) ;
const url _1 = _ _webpack _require _ _ ( 835 ) ;
const internal _utils _1 = _ _webpack _require _ _ ( 931 ) ;
const internal _config _variables _1 = _ _webpack _require _ _ ( 717 ) ;
/ * *
* Creates a file container for the new artifact in the remote blob storage / file service
* @ param { string } artifactName Name of the artifact being created
* @ returns The response from the Artifact Service if the file container was successfully created
* /
function createArtifactInFileContainer ( artifactName ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const parameters = {
Type : 'actions_storage' ,
Name : artifactName
} ;
const data = JSON . stringify ( parameters , null , 2 ) ;
const artifactUrl = internal _utils _1 . getArtifactUrl ( ) ;
const client = internal _utils _1 . createHttpClient ( ) ;
const requestOptions = internal _utils _1 . getRequestOptions ( 'application/json' ) ;
const rawResponse = yield client . post ( artifactUrl , data , requestOptions ) ;
const body = yield rawResponse . readBody ( ) ;
if ( internal _utils _1 . isSuccessStatusCode ( rawResponse . message . statusCode ) && body ) {
return JSON . parse ( body ) ;
}
else {
// eslint-disable-next-line no-console
console . log ( rawResponse ) ;
throw new Error ( ` Unable to create a container for the artifact ${ artifactName } ` ) ;
}
} ) ;
}
exports . createArtifactInFileContainer = createArtifactInFileContainer ;
/ * *
* Concurrently upload all of the files in chunks
* @ param { string } uploadUrl Base Url for the artifact that was created
* @ param { SearchResult [ ] } filesToUpload A list of information about the files being uploaded
* @ returns The size of all the files uploaded in bytes
* /
function uploadArtifactToFileContainer ( uploadUrl , filesToUpload , options ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const client = internal _utils _1 . createHttpClient ( ) ;
const FILE _CONCURRENCY = internal _config _variables _1 . getUploadFileConcurrency ( ) ;
const CHUNK _CONCURRENCY = internal _config _variables _1 . getUploadChunkConcurrency ( ) ;
const MAX _CHUNK _SIZE = internal _config _variables _1 . getUploadChunkSize ( ) ;
core _1 . debug ( ` File Concurrency: ${ FILE _CONCURRENCY } , Chunk Concurrency: ${ CHUNK _CONCURRENCY } and Chunk Size: ${ MAX _CHUNK _SIZE } ` ) ;
const parameters = [ ] ;
// by default, file uploads will continue if there is an error unless specified differently in the options
let continueOnError = true ;
if ( options ) {
if ( options . continueOnError === false ) {
continueOnError = false ;
}
}
// Prepare the necessary parameters to upload all the files
for ( const file of filesToUpload ) {
const resourceUrl = new url _1 . URL ( uploadUrl ) ;
resourceUrl . searchParams . append ( 'itemPath' , file . uploadFilePath ) ;
parameters . push ( {
file : file . absoluteFilePath ,
resourceUrl : resourceUrl . toString ( ) ,
restClient : client ,
concurrency : CHUNK _CONCURRENCY ,
maxChunkSize : MAX _CHUNK _SIZE ,
continueOnError
} ) ;
}
const parallelUploads = [ ... new Array ( FILE _CONCURRENCY ) . keys ( ) ] ;
const failedItemsToReport = [ ] ;
let uploadedFiles = 0 ;
let fileSizes = 0 ;
let abortPendingFileUploads = false ;
// Only allow a certain amount of files to be uploaded at once, this is done to reduce potential errors
yield Promise . all ( parallelUploads . map ( ( ) => _ _awaiter ( this , void 0 , void 0 , function * ( ) {
while ( uploadedFiles < filesToUpload . length ) {
const currentFileParameters = parameters [ uploadedFiles ] ;
uploadedFiles += 1 ;
if ( abortPendingFileUploads ) {
failedItemsToReport . push ( currentFileParameters . file ) ;
continue ;
}
const uploadFileResult = yield uploadFileAsync ( currentFileParameters ) ;
fileSizes += uploadFileResult . successfulUploadSize ;
if ( uploadFileResult . isSuccess === false ) {
failedItemsToReport . push ( currentFileParameters . file ) ;
if ( ! continueOnError ) {
// Existing uploads will be able to finish however all pending uploads will fail fast
abortPendingFileUploads = true ;
}
}
}
} ) ) ) ;
core _1 . info ( ` Total size of all the files uploaded is ${ fileSizes } bytes ` ) ;
return {
size : fileSizes ,
failedItems : failedItemsToReport
} ;
} ) ;
}
exports . uploadArtifactToFileContainer = uploadArtifactToFileContainer ;
/ * *
* Asynchronously uploads a file . If the file is bigger than the max chunk size it will be uploaded via multiple calls
* @ param { UploadFileParameters } parameters Information about the file that needs to be uploaded
* @ returns The size of the file that was uploaded in bytes along with any failed uploads
* /
function uploadFileAsync ( parameters ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const fileSize = fs . statSync ( parameters . file ) . size ;
const parallelUploads = [ ... new Array ( parameters . concurrency ) . keys ( ) ] ;
let offset = 0 ;
let isUploadSuccessful = true ;
let failedChunkSizes = 0 ;
let abortFileUpload = false ;
yield Promise . all ( parallelUploads . map ( ( ) => _ _awaiter ( this , void 0 , void 0 , function * ( ) {
while ( offset < fileSize ) {
const chunkSize = Math . min ( fileSize - offset , parameters . maxChunkSize ) ;
if ( abortFileUpload ) {
// if we don't want to continue on error, any pending upload chunk will be marked as failed
failedChunkSizes += chunkSize ;
continue ;
}
const start = offset ;
const end = offset + chunkSize - 1 ;
offset += parameters . maxChunkSize ;
const chunk = fs . createReadStream ( parameters . file , {
start ,
end ,
autoClose : false
} ) ;
const result = yield uploadChunk ( parameters . restClient , parameters . resourceUrl , chunk , start , end , fileSize ) ;
if ( ! result ) {
/ * *
* Chunk failed to upload , report as failed and do not continue uploading any more chunks for the file . It is possible that part of a chunk was
* successfully uploaded so the server may report a different size for what was uploaded
* * /
isUploadSuccessful = false ;
failedChunkSizes += chunkSize ;
core _1 . warning ( ` Aborting upload for ${ parameters . file } due to failure ` ) ;
abortFileUpload = true ;
}
}
} ) ) ) ;
return {
isSuccess : isUploadSuccessful ,
successfulUploadSize : fileSize - failedChunkSizes
} ;
} ) ;
}
/ * *
* Uploads a chunk of an individual file to the specified resourceUrl . If the upload fails and the status code
* indicates a retryable status , we try to upload the chunk as well
* @ param { HttpClient } restClient RestClient that will be making the appropriate HTTP call
* @ param { string } resourceUrl Url of the resource that the chunk will be uploaded to
* @ param { NodeJS . ReadableStream } data Stream of the file that will be uploaded
* @ param { number } start Starting byte index of file that the chunk belongs to
* @ param { number } end Ending byte index of file that the chunk belongs to
* @ param { number } totalSize Total size of the file in bytes that is being uploaded
* @ returns if the chunk was successfully uploaded
* /
function uploadChunk ( restClient , resourceUrl , data , start , end , totalSize ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
core _1 . info ( ` Uploading chunk of size ${ end -
start +
1 } bytes at offset $ { start } with content range : $ { internal _utils _1 . getContentRange ( start , end , totalSize ) } ` );
const requestOptions = internal _utils _1 . getRequestOptions ( 'application/octet-stream' , totalSize , internal _utils _1 . getContentRange ( start , end , totalSize ) ) ;
const uploadChunkRequest = ( ) => _ _awaiter ( this , void 0 , void 0 , function * ( ) {
return yield restClient . sendStream ( 'PUT' , resourceUrl , data , requestOptions ) ;
} ) ;
const response = yield uploadChunkRequest ( ) ;
if ( internal _utils _1 . isSuccessStatusCode ( response . message . statusCode ) ) {
core _1 . debug ( ` Chunk for ${ start } : ${ end } was successfully uploaded to ${ resourceUrl } ` ) ;
return true ;
}
else if ( internal _utils _1 . isRetryableStatusCode ( response . message . statusCode ) ) {
core _1 . info ( ` Received http ${ response . message . statusCode } during chunk upload, will retry at offset ${ start } after 10 seconds. ` ) ;
yield new Promise ( resolve => setTimeout ( resolve , 10000 ) ) ;
const retryResponse = yield uploadChunkRequest ( ) ;
if ( internal _utils _1 . isSuccessStatusCode ( retryResponse . message . statusCode ) ) {
return true ;
}
else {
core _1 . info ( ` Unable to upload chunk even after retrying ` ) ;
// eslint-disable-next-line no-console
console . log ( response ) ;
return false ;
}
}
// Upload must have failed spectacularly somehow, log full result for diagnostic purposes
// eslint-disable-next-line no-console
console . log ( response ) ;
return false ;
} ) ;
}
/ * *
* Updates the size of the artifact from - 1 which was initially set when the container was first created for the artifact .
* Updating the size indicates that we are done uploading all the contents of the artifact . A server side check will be run
* to check that the artifact size is correct for billing purposes
* /
function patchArtifactSize ( size , artifactName ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const client = internal _utils _1 . createHttpClient ( ) ;
const requestOptions = internal _utils _1 . getRequestOptions ( 'application/json' ) ;
const resourceUrl = new url _1 . URL ( internal _utils _1 . getArtifactUrl ( ) ) ;
resourceUrl . searchParams . append ( 'artifactName' , artifactName ) ;
const parameters = { Size : size } ;
const data = JSON . stringify ( parameters , null , 2 ) ;
core _1 . debug ( ` URL is ${ resourceUrl . toString ( ) } ` ) ;
const rawResponse = yield client . patch ( resourceUrl . toString ( ) , data , requestOptions ) ;
const body = yield rawResponse . readBody ( ) ;
if ( internal _utils _1 . isSuccessStatusCode ( rawResponse . message . statusCode ) ) {
core _1 . debug ( ` Artifact ${ artifactName } has been successfully uploaded, total size ${ size } ` ) ;
core _1 . debug ( body ) ;
}
else if ( rawResponse . message . statusCode === 404 ) {
throw new Error ( ` An Artifact with the name ${ artifactName } was not found ` ) ;
}
else {
// eslint-disable-next-line no-console
console . log ( body ) ;
throw new Error ( ` Unable to finish uploading artifact ${ artifactName } ` ) ;
}
} ) ;
}
exports . patchArtifactSize = patchArtifactSize ;
//# sourceMappingURL=internal-upload-http-client.js.map
/***/ } ) ,
/***/ 717 :
/***/ ( function ( _ _unusedmodule , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
function getUploadFileConcurrency ( ) {
return 2 ;
}
exports . getUploadFileConcurrency = getUploadFileConcurrency ;
function getUploadChunkConcurrency ( ) {
return 1 ;
}
exports . getUploadChunkConcurrency = getUploadChunkConcurrency ;
function getUploadChunkSize ( ) {
return 4 * 1024 * 1024 ; // 4 MB Chunks
}
exports . getUploadChunkSize = getUploadChunkSize ;
function getDownloadFileConcurrency ( ) {
return 2 ;
}
exports . getDownloadFileConcurrency = getDownloadFileConcurrency ;
function getDownloadArtifactConcurrency ( ) {
// when downloading all artifact at once, this is number of concurrent artifacts being downloaded
return 1 ;
}
exports . getDownloadArtifactConcurrency = getDownloadArtifactConcurrency ;
function getRuntimeToken ( ) {
const token = process . env [ 'ACTIONS_RUNTIME_TOKEN' ] ;
if ( ! token ) {
throw new Error ( 'Unable to get ACTIONS_RUNTIME_TOKEN env variable' ) ;
}
return token ;
}
exports . getRuntimeToken = getRuntimeToken ;
function getRuntimeUrl ( ) {
const runtimeUrl = process . env [ 'ACTIONS_RUNTIME_URL' ] ;
if ( ! runtimeUrl ) {
throw new Error ( 'Unable to get ACTIONS_RUNTIME_URL env variable' ) ;
}
return runtimeUrl ;
}
exports . getRuntimeUrl = getRuntimeUrl ;
function getWorkFlowRunId ( ) {
const workFlowRunId = process . env [ 'GITHUB_RUN_ID' ] ;
if ( ! workFlowRunId ) {
throw new Error ( 'Unable to get GITHUB_RUN_ID env variable' ) ;
}
return workFlowRunId ;
}
exports . getWorkFlowRunId = getWorkFlowRunId ;
function getWorkSpaceDirectory ( ) {
const workspaceDirectory = process . env [ 'GITHUB_WORKSPACE' ] ;
if ( ! workspaceDirectory ) {
throw new Error ( 'Unable to get GITHUB_WORKSPACE env variable' ) ;
}
return workspaceDirectory ;
}
exports . getWorkSpaceDirectory = getWorkSpaceDirectory ;
//# sourceMappingURL=internal-config-variables.js.map
/***/ } ) ,
/***/ 728 :
/***/ ( function ( _ _unusedmodule , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
class SearchState {
constructor ( path , level ) {
this . path = path ;
this . level = level ;
}
}
exports . SearchState = SearchState ;
//# sourceMappingURL=internal-search-state.js.map
/***/ } ) ,
/***/ 747 :
/***/ ( function ( module ) {
module . exports = require ( "fs" ) ;
/***/ } ) ,
/***/ 835 :
/***/ ( function ( module ) {
module . exports = require ( "url" ) ;
/***/ } ) ,
/***/ 896 :
/***/ ( function ( module ) {
module . exports = function ( xs , fn ) {
var res = [ ] ;
for ( var i = 0 ; i < xs . length ; i ++ ) {
var x = fn ( xs [ i ] , i ) ;
if ( isArray ( x ) ) res . push . apply ( res , x ) ;
else res . push ( x ) ;
}
return res ;
} ;
var isArray = Array . isArray || function ( xs ) {
return Object . prototype . toString . call ( xs ) === '[object Array]' ;
} ;
/***/ } ) ,
/***/ 923 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const assert = _ _webpack _require _ _ ( 357 ) ;
const os = _ _webpack _require _ _ ( 87 ) ;
const path = _ _webpack _require _ _ ( 622 ) ;
const pathHelper = _ _webpack _require _ _ ( 972 ) ;
const minimatch _1 = _ _webpack _require _ _ ( 93 ) ;
const internal _match _kind _1 = _ _webpack _require _ _ ( 327 ) ;
const internal _path _1 = _ _webpack _require _ _ ( 383 ) ;
const IS _WINDOWS = process . platform === 'win32' ;
class Pattern {
constructor ( patternOrNegate , segments ) {
/ * *
* Indicates whether matches should be excluded from the result set
* /
this . negate = false ;
// Pattern overload
let pattern ;
if ( typeof patternOrNegate === 'string' ) {
pattern = patternOrNegate . trim ( ) ;
}
// Segments overload
else {
// Convert to pattern
segments = segments || [ ] ;
assert ( segments . length , ` Parameter 'segments' must not empty ` ) ;
const root = Pattern . getLiteral ( segments [ 0 ] ) ;
assert ( root && pathHelper . hasAbsoluteRoot ( root ) , ` Parameter 'segments' first element must be a root path ` ) ;
pattern = new internal _path _1 . Path ( segments ) . toString ( ) . trim ( ) ;
if ( patternOrNegate ) {
pattern = ` ! ${ pattern } ` ;
}
}
// Negate
while ( pattern . startsWith ( '!' ) ) {
this . negate = ! this . negate ;
pattern = pattern . substr ( 1 ) . trim ( ) ;
}
// Normalize slashes and ensures absolute root
pattern = Pattern . fixupPattern ( pattern ) ;
// Segments
this . segments = new internal _path _1 . Path ( pattern ) . segments ;
// Trailing slash indicates the pattern should only match directories, not regular files
this . trailingSeparator = pathHelper
. normalizeSeparators ( pattern )
. endsWith ( path . sep ) ;
pattern = pathHelper . safeTrimTrailingSeparator ( pattern ) ;
// Search path (literal path prior to the first glob segment)
let foundGlob = false ;
const searchSegments = this . segments
. map ( x => Pattern . getLiteral ( x ) )
. filter ( x => ! foundGlob && ! ( foundGlob = x === '' ) ) ;
this . searchPath = new internal _path _1 . Path ( searchSegments ) . toString ( ) ;
// Root RegExp (required when determining partial match)
this . rootRegExp = new RegExp ( Pattern . regExpEscape ( searchSegments [ 0 ] ) , IS _WINDOWS ? 'i' : '' ) ;
// Create minimatch
const minimatchOptions = {
dot : true ,
nobrace : true ,
nocase : IS _WINDOWS ,
nocomment : true ,
noext : true ,
nonegate : true
} ;
pattern = IS _WINDOWS ? pattern . replace ( /\\/g , '/' ) : pattern ;
this . minimatch = new minimatch _1 . Minimatch ( pattern , minimatchOptions ) ;
}
/ * *
* Matches the pattern against the specified path
* /
match ( itemPath ) {
// Last segment is globstar?
if ( this . segments [ this . segments . length - 1 ] === '**' ) {
// Normalize slashes
itemPath = pathHelper . normalizeSeparators ( itemPath ) ;
// Append a trailing slash. Otherwise Minimatch will not match the directory immediately
// preceeding the globstar. For example, given the pattern `/foo/**`, Minimatch returns
// false for `/foo` but returns true for `/foo/`. Append a trailing slash to handle that quirk.
if ( ! itemPath . endsWith ( path . sep ) ) {
// Note, this is safe because the constructor ensures the pattern has an absolute root.
// For example, formats like C: and C:foo on Windows are resolved to an aboslute root.
itemPath = ` ${ itemPath } ${ path . sep } ` ;
}
}
else {
// Normalize slashes and trim unnecessary trailing slash
itemPath = pathHelper . safeTrimTrailingSeparator ( itemPath ) ;
}
// Match
if ( this . minimatch . match ( itemPath ) ) {
return this . trailingSeparator ? internal _match _kind _1 . MatchKind . Directory : internal _match _kind _1 . MatchKind . All ;
}
return internal _match _kind _1 . MatchKind . None ;
}
/ * *
* Indicates whether the pattern may match descendants of the specified path
* /
partialMatch ( itemPath ) {
// Normalize slashes and trim unnecessary trailing slash
itemPath = pathHelper . safeTrimTrailingSeparator ( itemPath ) ;
// matchOne does not handle root path correctly
if ( pathHelper . dirname ( itemPath ) === itemPath ) {
return this . rootRegExp . test ( itemPath ) ;
}
return this . minimatch . matchOne ( itemPath . split ( IS _WINDOWS ? /\\+/ : /\/+/ ) , this . minimatch . set [ 0 ] , true ) ;
}
/ * *
* Escapes glob patterns within a path
* /
static globEscape ( s ) {
return ( IS _WINDOWS ? s : s . replace ( /\\/g , '\\\\' ) ) // escape '\' on Linux/macOS
. replace ( /(\[)(?=[^/]+\])/g , '[[]' ) // escape '[' when ']' follows within the path segment
. replace ( /\?/g , '[?]' ) // escape '?'
. replace ( /\*/g , '[*]' ) ; // escape '*'
}
/ * *
* Normalizes slashes and ensures absolute root
* /
static fixupPattern ( pattern ) {
// Empty
assert ( pattern , 'pattern cannot be empty' ) ;
// Must not contain `.` segment, unless first segment
// Must not contain `..` segment
const literalSegments = new internal _path _1 . Path ( pattern ) . segments . map ( x => Pattern . getLiteral ( x ) ) ;
assert ( literalSegments . every ( ( x , i ) => ( x !== '.' || i === 0 ) && x !== '..' ) , ` Invalid pattern ' ${ pattern } '. Relative pathing '.' and '..' is not allowed. ` ) ;
// Must not contain globs in root, e.g. Windows UNC path \\foo\b*r
assert ( ! pathHelper . hasRoot ( pattern ) || literalSegments [ 0 ] , ` Invalid pattern ' ${ pattern } '. Root segment must not contain globs. ` ) ;
// Normalize slashes
pattern = pathHelper . normalizeSeparators ( pattern ) ;
// Replace leading `.` segment
if ( pattern === '.' || pattern . startsWith ( ` . ${ path . sep } ` ) ) {
pattern = Pattern . globEscape ( process . cwd ( ) ) + pattern . substr ( 1 ) ;
}
// Replace leading `~` segment
else if ( pattern === '~' || pattern . startsWith ( ` ~ ${ path . sep } ` ) ) {
const homedir = os . homedir ( ) ;
assert ( homedir , 'Unable to determine HOME directory' ) ;
assert ( pathHelper . hasAbsoluteRoot ( homedir ) , ` Expected HOME directory to be a rooted path. Actual ' ${ homedir } ' ` ) ;
pattern = Pattern . globEscape ( homedir ) + pattern . substr ( 1 ) ;
}
// Replace relative drive root, e.g. pattern is C: or C:foo
else if ( IS _WINDOWS &&
( pattern . match ( /^[A-Z]:$/i ) || pattern . match ( /^[A-Z]:[^\\]/i ) ) ) {
let root = pathHelper . ensureAbsoluteRoot ( 'C:\\dummy-root' , pattern . substr ( 0 , 2 ) ) ;
if ( pattern . length > 2 && ! root . endsWith ( '\\' ) ) {
root += '\\' ;
}
pattern = Pattern . globEscape ( root ) + pattern . substr ( 2 ) ;
}
// Replace relative root, e.g. pattern is \ or \foo
else if ( IS _WINDOWS && ( pattern === '\\' || pattern . match ( /^\\[^\\]/ ) ) ) {
let root = pathHelper . ensureAbsoluteRoot ( 'C:\\dummy-root' , '\\' ) ;
if ( ! root . endsWith ( '\\' ) ) {
root += '\\' ;
}
pattern = Pattern . globEscape ( root ) + pattern . substr ( 1 ) ;
}
// Otherwise ensure absolute root
else {
pattern = pathHelper . ensureAbsoluteRoot ( Pattern . globEscape ( process . cwd ( ) ) , pattern ) ;
}
return pathHelper . normalizeSeparators ( pattern ) ;
}
/ * *
* Attempts to unescape a pattern segment to create a literal path segment .
* Otherwise returns empty string .
* /
static getLiteral ( segment ) {
let literal = '' ;
for ( let i = 0 ; i < segment . length ; i ++ ) {
const c = segment [ i ] ;
// Escape
if ( c === '\\' && ! IS _WINDOWS && i + 1 < segment . length ) {
literal += segment [ ++ i ] ;
continue ;
}
// Wildcard
else if ( c === '*' || c === '?' ) {
return '' ;
}
// Character set
else if ( c === '[' && i + 1 < segment . length ) {
let set = '' ;
let closed = - 1 ;
for ( let i2 = i + 1 ; i2 < segment . length ; i2 ++ ) {
const c2 = segment [ i2 ] ;
// Escape
if ( c2 === '\\' && ! IS _WINDOWS && i2 + 1 < segment . length ) {
set += segment [ ++ i2 ] ;
continue ;
}
// Closed
else if ( c2 === ']' ) {
closed = i2 ;
break ;
}
// Otherwise
else {
set += c2 ;
}
}
// Closed?
if ( closed >= 0 ) {
// Cannot convert
if ( set . length > 1 ) {
return '' ;
}
// Convert to literal
if ( set ) {
literal += set ;
i = closed ;
continue ;
}
}
// Otherwise fall thru
}
// Append
literal += c ;
}
return literal ;
}
/ * *
* Escapes regexp special characters
* https : //javascript.info/regexp-escaping
* /
static regExpEscape ( s ) {
return s . replace ( /[[\\^$.|?*+()]/g , '\\$&' ) ;
}
}
exports . Pattern = Pattern ;
//# sourceMappingURL=internal-pattern.js.map
/***/ } ) ,
/***/ 931 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _awaiter = ( this && this . _ _awaiter ) || function ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const core _1 = _ _webpack _require _ _ ( 470 ) ;
const fs _1 = _ _webpack _require _ _ ( 747 ) ;
const http _client _1 = _ _webpack _require _ _ ( 539 ) ;
const auth _1 = _ _webpack _require _ _ ( 226 ) ;
const internal _config _variables _1 = _ _webpack _require _ _ ( 717 ) ;
/ * *
* Parses a env variable that is a number
* /
function parseEnvNumber ( key ) {
const value = Number ( process . env [ key ] ) ;
if ( Number . isNaN ( value ) || value < 0 ) {
return undefined ;
}
return value ;
}
exports . parseEnvNumber = parseEnvNumber ;
/ * *
* Various utility functions to help with the necessary API calls
* /
function getApiVersion ( ) {
return '6.0-preview' ;
}
exports . getApiVersion = getApiVersion ;
function isSuccessStatusCode ( statusCode ) {
if ( ! statusCode ) {
return false ;
}
return statusCode >= 200 && statusCode < 300 ;
}
exports . isSuccessStatusCode = isSuccessStatusCode ;
function isRetryableStatusCode ( statusCode ) {
if ( ! statusCode ) {
return false ;
}
const retryableStatusCodes = [
http _client _1 . HttpCodes . BadGateway ,
http _client _1 . HttpCodes . ServiceUnavailable ,
http _client _1 . HttpCodes . GatewayTimeout
] ;
return retryableStatusCodes . includes ( statusCode ) ;
}
exports . isRetryableStatusCode = isRetryableStatusCode ;
function getContentRange ( start , end , total ) {
// Format: `bytes start-end/fileSize
// start and end are inclusive
// For a 200 byte chunk starting at byte 0:
// Content-Range: bytes 0-199/200
return ` bytes ${ start } - ${ end } / ${ total } ` ;
}
exports . getContentRange = getContentRange ;
function getRequestOptions ( contentType , contentLength , contentRange ) {
const requestOptions = {
Accept : ` application/json;api-version= ${ getApiVersion ( ) } `
} ;
if ( contentType ) {
requestOptions [ 'Content-Type' ] = contentType ;
}
if ( contentLength ) {
requestOptions [ 'Content-Length' ] = contentLength ;
}
if ( contentRange ) {
requestOptions [ 'Content-Range' ] = contentRange ;
}
return requestOptions ;
}
exports . getRequestOptions = getRequestOptions ;
function createHttpClient ( ) {
return new http _client _1 . HttpClient ( 'action/artifact' , [
new auth _1 . BearerCredentialHandler ( internal _config _variables _1 . getRuntimeToken ( ) )
] ) ;
}
exports . createHttpClient = createHttpClient ;
function getArtifactUrl ( ) {
const artifactUrl = ` ${ internal _config _variables _1 . getRuntimeUrl ( ) } _apis/pipelines/workflows/ ${ internal _config _variables _1 . getWorkFlowRunId ( ) } /artifacts?api-version= ${ getApiVersion ( ) } ` ;
core _1 . debug ( ` Artifact Url: ${ artifactUrl } ` ) ;
return artifactUrl ;
}
exports . getArtifactUrl = getArtifactUrl ;
/ * *
* Invalid characters that cannot be in the artifact name or an uploaded file . Will be rejected
* from the server if attempted to be sent over . These characters are not allowed due to limitations with certain
* file systems such as NTFS . To maintain platform - agnostic behavior , all characters that are not supported by an
* individual filesystem / platform will not be supported on all fileSystems / platforms
* /
const invalidCharacters = [ '\\' , '/' , '"' , ':' , '<' , '>' , '|' , '*' , '?' , ' ' ] ;
/ * *
* Scans the name of the item being uploaded to make sure there are no illegal characters
* /
function checkArtifactName ( name ) {
if ( ! name ) {
throw new Error ( ` Artifact name: ${ name } , is incorrectly provided ` ) ;
}
for ( const invalidChar of invalidCharacters ) {
if ( name . includes ( invalidChar ) ) {
throw new Error ( ` Artifact name is not valid: ${ name } . Contains character: " ${ invalidChar } ". Invalid characters include: ${ invalidCharacters . toString ( ) } . ` ) ;
}
}
}
exports . checkArtifactName = checkArtifactName ;
function createDirectoriesForArtifact ( directories ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
for ( const directory of directories ) {
yield fs _1 . promises . mkdir ( directory , {
recursive : true
} ) ;
}
} ) ;
}
exports . createDirectoriesForArtifact = createDirectoriesForArtifact ;
//# sourceMappingURL=internal-utils.js.map
/***/ } ) ,
/***/ 950 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const url = _ _webpack _require _ _ ( 835 ) ;
function getProxyUrl ( reqUrl ) {
let usingSsl = reqUrl . protocol === 'https:' ;
let proxyUrl ;
if ( checkBypass ( reqUrl ) ) {
return proxyUrl ;
}
let proxyVar ;
if ( usingSsl ) {
proxyVar = process . env [ "https_proxy" ] ||
process . env [ "HTTPS_PROXY" ] ;
}
else {
proxyVar = process . env [ "http_proxy" ] ||
process . env [ "HTTP_PROXY" ] ;
}
if ( proxyVar ) {
proxyUrl = url . parse ( proxyVar ) ;
}
return proxyUrl ;
}
exports . getProxyUrl = getProxyUrl ;
function checkBypass ( reqUrl ) {
if ( ! reqUrl . hostname ) {
return false ;
}
let noProxy = process . env [ "no_proxy" ] || process . env [ "NO_PROXY" ] || '' ;
if ( ! noProxy ) {
return false ;
}
// Determine the request port
let reqPort ;
if ( reqUrl . port ) {
reqPort = Number ( reqUrl . port ) ;
}
else if ( reqUrl . protocol === 'http:' ) {
reqPort = 80 ;
}
else if ( reqUrl . protocol === 'https:' ) {
reqPort = 443 ;
}
// Format the request hostname and hostname with port
let upperReqHosts = [ reqUrl . hostname . toUpperCase ( ) ] ;
if ( typeof reqPort === 'number' ) {
upperReqHosts . push ( ` ${ upperReqHosts [ 0 ] } : ${ reqPort } ` ) ;
}
// Compare request host against noproxy
for ( let upperNoProxyItem of noProxy . split ( ',' ) . map ( x => x . trim ( ) . toUpperCase ( ) ) . filter ( x => x ) ) {
if ( upperReqHosts . some ( x => x === upperNoProxyItem ) ) {
return true ;
}
}
return false ;
}
exports . checkBypass = checkBypass ;
/***/ } ) ,
/***/ 972 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const assert = _ _webpack _require _ _ ( 357 ) ;
const path = _ _webpack _require _ _ ( 622 ) ;
const IS _WINDOWS = process . platform === 'win32' ;
/ * *
* Similar to path . dirname except normalizes the path separators and slightly better handling for Windows UNC paths .
*
* For example , on Linux / macOS :
* - ` / => / `
* - ` /hello => / `
*
* For example , on Windows :
* - ` C: \ => C: \`
* - ` C: \h ello => C: \`
* - ` C: => C: `
* - ` C:hello => C: `
* - ` \ => \`
* - ` \h ello => \`
* - ` \\ hello => \\ hello `
* - ` \\ hello \w orld => \\ hello \w orld `
* /
function dirname ( p ) {
// Normalize slashes and trim unnecessary trailing slash
p = safeTrimTrailingSeparator ( p ) ;
// Windows UNC root, e.g. \\hello or \\hello\world
if ( IS _WINDOWS && /^\\\\[^\\]+(\\[^\\]+)?$/ . test ( p ) ) {
return p ;
}
// Get dirname
let result = path . dirname ( p ) ;
// Trim trailing slash for Windows UNC root, e.g. \\hello\world\
if ( IS _WINDOWS && /^\\\\[^\\]+\\[^\\]+\\$/ . test ( result ) ) {
result = safeTrimTrailingSeparator ( result ) ;
}
return result ;
}
exports . dirname = dirname ;
/ * *
* Roots the path if not already rooted . On Windows , relative roots like ` \`
* or ` C: ` are expanded based on the current working directory .
* /
function ensureAbsoluteRoot ( root , itemPath ) {
assert ( root , ` ensureAbsoluteRoot parameter 'root' must not be empty ` ) ;
assert ( itemPath , ` ensureAbsoluteRoot parameter 'itemPath' must not be empty ` ) ;
// Already rooted
if ( hasAbsoluteRoot ( itemPath ) ) {
return itemPath ;
}
// Windows
if ( IS _WINDOWS ) {
// Check for itemPath like C: or C:foo
if ( itemPath . match ( /^[A-Z]:[^\\/]|^[A-Z]:$/i ) ) {
let cwd = process . cwd ( ) ;
assert ( cwd . match ( /^[A-Z]:\\/i ) , ` Expected current directory to start with an absolute drive root. Actual ' ${ cwd } ' ` ) ;
// Drive letter matches cwd? Expand to cwd
if ( itemPath [ 0 ] . toUpperCase ( ) === cwd [ 0 ] . toUpperCase ( ) ) {
// Drive only, e.g. C:
if ( itemPath . length === 2 ) {
// Preserve specified drive letter case (upper or lower)
return ` ${ itemPath [ 0 ] } : \\ ${ cwd . substr ( 3 ) } ` ;
}
// Drive + path, e.g. C:foo
else {
if ( ! cwd . endsWith ( '\\' ) ) {
cwd += '\\' ;
}
// Preserve specified drive letter case (upper or lower)
return ` ${ itemPath [ 0 ] } : \\ ${ cwd . substr ( 3 ) } ${ itemPath . substr ( 2 ) } ` ;
}
}
// Different drive
else {
return ` ${ itemPath [ 0 ] } : \\ ${ itemPath . substr ( 2 ) } ` ;
}
}
// Check for itemPath like \ or \foo
else if ( normalizeSeparators ( itemPath ) . match ( /^\\$|^\\[^\\]/ ) ) {
const cwd = process . cwd ( ) ;
assert ( cwd . match ( /^[A-Z]:\\/i ) , ` Expected current directory to start with an absolute drive root. Actual ' ${ cwd } ' ` ) ;
return ` ${ cwd [ 0 ] } : \\ ${ itemPath . substr ( 1 ) } ` ;
}
}
assert ( hasAbsoluteRoot ( root ) , ` ensureAbsoluteRoot parameter 'root' must have an absolute root ` ) ;
// Otherwise ensure root ends with a separator
if ( root . endsWith ( '/' ) || ( IS _WINDOWS && root . endsWith ( '\\' ) ) ) {
// Intentionally empty
}
else {
// Append separator
root += path . sep ;
}
return root + itemPath ;
}
exports . ensureAbsoluteRoot = ensureAbsoluteRoot ;
/ * *
* On Linux / macOS , true if path starts with ` / ` . On Windows , true for paths like :
* ` \\ hello \s hare ` and ` C: \h ello ` ( and using alternate separator ) .
* /
function hasAbsoluteRoot ( itemPath ) {
assert ( itemPath , ` hasAbsoluteRoot parameter 'itemPath' must not be empty ` ) ;
// Normalize separators
itemPath = normalizeSeparators ( itemPath ) ;
// Windows
if ( IS _WINDOWS ) {
// E.g. \\hello\share or C:\hello
return itemPath . startsWith ( '\\\\' ) || /^[A-Z]:\\/i . test ( itemPath ) ;
}
// E.g. /hello
return itemPath . startsWith ( '/' ) ;
}
exports . hasAbsoluteRoot = hasAbsoluteRoot ;
/ * *
* On Linux / macOS , true if path starts with ` / ` . On Windows , true for paths like :
* ` \` , ` \ hello ` , ` \ \ hello \ share ` , ` C : ` , and ` C : \ hello ` (and using alternate separator).
* /
function hasRoot ( itemPath ) {
assert ( itemPath , ` isRooted parameter 'itemPath' must not be empty ` ) ;
// Normalize separators
itemPath = normalizeSeparators ( itemPath ) ;
// Windows
if ( IS _WINDOWS ) {
// E.g. \ or \hello or \\hello
// E.g. C: or C:\hello
return itemPath . startsWith ( '\\' ) || /^[A-Z]:/i . test ( itemPath ) ;
}
// E.g. /hello
return itemPath . startsWith ( '/' ) ;
}
exports . hasRoot = hasRoot ;
/ * *
* Removes redundant slashes and converts ` / ` to ` \` on Windows
* /
function normalizeSeparators ( p ) {
p = p || '' ;
// Windows
if ( IS _WINDOWS ) {
// Convert slashes on Windows
p = p . replace ( /\//g , '\\' ) ;
// Remove redundant slashes
const isUnc = /^\\\\+[^\\]/ . test ( p ) ; // e.g. \\hello
return ( isUnc ? '\\' : '' ) + p . replace ( /\\\\+/g , '\\' ) ; // preserve leading \\ for UNC
}
// Remove redundant slashes
return p . replace ( /\/\/+/g , '/' ) ;
}
exports . normalizeSeparators = normalizeSeparators ;
/ * *
* Normalizes the path separators and trims the trailing separator ( when safe ) .
* For example , ` /foo/ => /foo ` but ` / => / `
* /
function safeTrimTrailingSeparator ( p ) {
// Short-circuit if empty
if ( ! p ) {
return '' ;
}
// Normalize separators
p = normalizeSeparators ( p ) ;
// No trailing slash
if ( ! p . endsWith ( path . sep ) ) {
return p ;
}
// Check '/' on Linux/macOS and '\' on Windows
if ( p === path . sep ) {
return p ;
}
// On Windows check if drive root. E.g. C:\
if ( IS _WINDOWS && /^[A-Z]:\\$/i . test ( p ) ) {
return p ;
}
// Otherwise trim trailing slash
return p . substr ( 0 , p . length - 1 ) ;
}
exports . safeTrimTrailingSeparator = safeTrimTrailingSeparator ;
//# sourceMappingURL=internal-path-helper.js.map
/***/ } )
/******/ } ) ;