idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
151,500
public int expect ( String pattern ) throws MalformedPatternException , Exception { logger . trace ( "Searching for '" + pattern + "' in the reader stream" ) ; return expect ( pattern , null ) ; }
Attempts to detect the provided pattern as an exact match .
151,501
protected ExpectState prepareClosure ( int pairIndex , MatchResult result ) { ExpectState state ; Map < String , Object > prevMap = null ; if ( g_state != null ) { prevMap = g_state . getVars ( ) ; } int matchedWhere = result . beginOffset ( 0 ) ; String matchedText = result . toString ( ) ; char [ ] chBuffer = input ....
Don t use input it s match values might have been reset in the loop that looks for the first possible match .
151,502
public void cmdProc ( Interp interp , TclObject argv [ ] ) throws TclException { int currentObjIndex , len , i ; int objc = argv . length - 1 ; boolean doBackslashes = true ; boolean doCmds = true ; boolean doVars = true ; StringBuffer result = new StringBuffer ( ) ; String s ; char c ; for ( currentObjIndex = 1 ; curr...
This procedure is invoked to process the subst Tcl command . See the user documentation for details on what it does .
151,503
public static void mergeReports ( File reportOverall , File ... reports ) { SessionInfoStore infoStore = new SessionInfoStore ( ) ; ExecutionDataStore dataStore = new ExecutionDataStore ( ) ; boolean isCurrentVersionFormat = loadSourceFiles ( infoStore , dataStore , reports ) ; try ( BufferedOutputStream outputStream =...
Merge all reports in reportOverall .
151,504
public JaCoCoReportReader readJacocoReport ( IExecutionDataVisitor executionDataVisitor , ISessionInfoVisitor sessionInfoStore ) { if ( jacocoExecutionData == null ) { return this ; } JaCoCoExtensions . logger ( ) . info ( "Analysing {}" , jacocoExecutionData ) ; try ( InputStream inputStream = new BufferedInputStream ...
Read JaCoCo report determining the format to be used .
151,505
public ArtifactName build ( ) { String groupId = this . groupId ; String artifactId = this . artifactId ; String classifier = this . classifier ; String packaging = this . packaging ; String version = this . version ; if ( artifact != null && ! artifact . isEmpty ( ) ) { final String [ ] artifactSegments = artifact . s...
Creates the final artifact name .
151,506
public static Deployment of ( final File content ) { final DeploymentContent deploymentContent = DeploymentContent . of ( Assert . checkNotNullParam ( "content" , content ) . toPath ( ) ) ; return new Deployment ( deploymentContent , null ) ; }
Creates a new deployment for the file . If the file is a directory the content will be deployed exploded using the file system location .
151,507
public static Deployment of ( final Path content ) { final DeploymentContent deploymentContent = DeploymentContent . of ( Assert . checkNotNullParam ( "content" , content ) ) ; return new Deployment ( deploymentContent , null ) ; }
Creates a new deployment for the path . If the path is a directory the content will be deployed exploded using the file system location .
151,508
public static Deployment of ( final URL url ) { final DeploymentContent deploymentContent = DeploymentContent . of ( Assert . checkNotNullParam ( "url" , url ) ) ; return new Deployment ( deploymentContent , null ) ; }
Creates a new deployment for the URL . The target server will require access to the URL .
151,509
public Deployment setServerGroups ( final Collection < String > serverGroups ) { this . serverGroups . clear ( ) ; this . serverGroups . addAll ( serverGroups ) ; return this ; }
Sets the server groups for the deployment .
151,510
protected void validate ( final boolean isDomain ) throws MojoDeploymentException { final boolean hasServerGroups = hasServerGroups ( ) ; if ( isDomain ) { if ( ! hasServerGroups ) { throw new MojoDeploymentException ( "Server is running in domain mode, but no server groups have been defined." ) ; } } else if ( hasServ...
Validates the deployment .
151,511
private ModelNode buildAddOperation ( final ModelNode address , final Map < String , String > properties ) { final ModelNode op = ServerOperations . createAddOperation ( address ) ; for ( Map . Entry < String , String > prop : properties . entrySet ( ) ) { final String [ ] props = prop . getKey ( ) . split ( "," ) ; if...
Creates the operation to add a resource .
151,512
private void handleDmrString ( final ModelNode node , final String name , final String value ) { final String realValue = value . substring ( 2 ) ; node . get ( name ) . set ( ModelNode . fromString ( realValue ) ) ; }
Handles DMR strings in the configuration
151,513
private ModelNode parseAddress ( final String profileName , final String inputAddress ) { final ModelNode result = new ModelNode ( ) ; if ( profileName != null ) { result . add ( ServerOperations . PROFILE , profileName ) ; } String [ ] parts = inputAddress . split ( "," ) ; for ( String part : parts ) { String [ ] add...
Parses the comma delimited address into model nodes .
151,514
public static ContainerDescription getContainerDescription ( final ModelControllerClient client ) throws IOException , OperationExecutionException { return DefaultContainerDescription . lookup ( Assert . checkNotNullParam ( "client" , client ) ) ; }
Returns the description of the running container .
151,515
public static void waitForDomain ( final ModelControllerClient client , final long startupTimeout ) throws InterruptedException , RuntimeException , TimeoutException { waitForDomain ( null , client , startupTimeout ) ; }
Waits the given amount of time in seconds for a managed domain to start . A domain is considered started when each of the servers in the domain are started unless the server is disabled .
151,516
public static void shutdownDomain ( final ModelControllerClient client , final int timeout ) throws IOException , OperationExecutionException { final ModelNode stopServersOp = Operations . createOperation ( "stop-servers" ) ; stopServersOp . get ( "blocking" ) . set ( true ) ; stopServersOp . get ( "timeout" ) . set ( ...
Shuts down a managed domain container . The servers are first stopped then the host controller is shutdown .
151,517
public static ModelNode determineHostAddress ( final ModelControllerClient client ) throws IOException , OperationExecutionException { final ModelNode op = Operations . createReadAttributeOperation ( EMPTY_ADDRESS , "local-host-name" ) ; ModelNode response = client . execute ( op ) ; if ( Operations . isSuccessfulOutco...
Determines the address for the host being used .
151,518
public static void waitForStandalone ( final ModelControllerClient client , final long startupTimeout ) throws InterruptedException , RuntimeException , TimeoutException { waitForStandalone ( null , client , startupTimeout ) ; }
Waits the given amount of time in seconds for a standalone server to start .
151,519
public static boolean isStandaloneRunning ( final ModelControllerClient client ) { try { final ModelNode response = client . execute ( Operations . createReadAttributeOperation ( EMPTY_ADDRESS , "server-state" ) ) ; if ( Operations . isSuccessfulOutcome ( response ) ) { final String state = Operations . readResult ( re...
Checks to see if a standalone server is running .
151,520
public static void shutdownStandalone ( final ModelControllerClient client , final int timeout ) throws IOException { final ModelNode op = Operations . createOperation ( "shutdown" ) ; op . get ( "timeout" ) . set ( timeout ) ; final ModelNode response = client . execute ( op ) ; if ( Operations . isSuccessfulOutcome (...
Shuts down a standalone server .
151,521
public static PackageType resolve ( final MavenProject project ) { final String packaging = project . getPackaging ( ) . toLowerCase ( Locale . ROOT ) ; if ( DEFAULT_TYPES . containsKey ( packaging ) ) { return DEFAULT_TYPES . get ( packaging ) ; } return new PackageType ( packaging ) ; }
Resolves the package type from the maven project .
151,522
public static String getJavaCommand ( final Path javaHome ) { final Path resolvedJavaHome = javaHome == null ? findJavaHome ( ) : javaHome ; final String exe ; if ( resolvedJavaHome == null ) { exe = "java" ; } else { exe = resolvedJavaHome . resolve ( "bin" ) . resolve ( "java" ) . toString ( ) ; } if ( exe . contains...
Returns the Java command to use .
151,523
public static UndeployDescription of ( final DeploymentDescription deploymentDescription ) { Assert . checkNotNullParam ( "deploymentDescription" , deploymentDescription ) ; return of ( deploymentDescription . getName ( ) ) . addServerGroups ( deploymentDescription . getServerGroups ( ) ) ; }
Creates a new undeploy description .
151,524
public static Operation createDeployOperation ( final DeploymentDescription deployment ) { Assert . checkNotNullParam ( "deployment" , deployment ) ; final CompositeOperationBuilder builder = CompositeOperationBuilder . create ( true ) ; addDeployOperationStep ( builder , deployment ) ; return builder . build ( ) ; }
Creates an operation to deploy existing deployment content to the runtime .
151,525
public static Operation createDeployOperation ( final Set < DeploymentDescription > deployments ) { Assertions . requiresNotNullOrNotEmptyParameter ( "deployments" , deployments ) ; final CompositeOperationBuilder builder = CompositeOperationBuilder . create ( true ) ; for ( DeploymentDescription deployment : deploymen...
Creates an option to deploy existing content to the runtime for each deployment
151,526
static void addDeployOperationStep ( final CompositeOperationBuilder builder , final DeploymentDescription deployment ) { final String name = deployment . getName ( ) ; final Set < String > serverGroups = deployment . getServerGroups ( ) ; if ( serverGroups . isEmpty ( ) ) { final ModelNode address = createAddress ( DE...
Adds the deploy operation as a step to the composite operation .
151,527
private static void addRedeployOperationStep ( final CompositeOperationBuilder builder , final DeploymentDescription deployment ) { final String deploymentName = deployment . getName ( ) ; final Set < String > serverGroups = deployment . getServerGroups ( ) ; if ( serverGroups . isEmpty ( ) ) { builder . addStep ( crea...
Adds a redeploy step to the composite operation .
151,528
public static String getFailureDescriptionAsString ( final ModelNode result ) { if ( isSuccessfulOutcome ( result ) ) { return "" ; } final String msg ; if ( result . hasDefined ( ClientConstants . FAILURE_DESCRIPTION ) ) { if ( result . hasDefined ( ClientConstants . OP ) ) { msg = String . format ( "Operation '%s' at...
Parses the result and returns the failure description . If the result was successful an empty string is returned .
151,529
public static ModelNode createListDeploymentsOperation ( ) { final ModelNode op = createOperation ( READ_CHILDREN_NAMES ) ; op . get ( CHILD_TYPE ) . set ( DEPLOYMENT ) ; return op ; }
Creates an operation to list the deployments .
151,530
public static ModelNode createRemoveOperation ( final ModelNode address , final boolean recursive ) { final ModelNode op = createRemoveOperation ( address ) ; op . get ( RECURSIVE ) . set ( recursive ) ; return op ; }
Creates a remove operation .
151,531
public static Property getChildAddress ( final ModelNode address ) { if ( address . getType ( ) != ModelType . LIST ) { throw new IllegalArgumentException ( "The address type must be a list." ) ; } final List < Property > addressParts = address . asPropertyList ( ) ; if ( addressParts . isEmpty ( ) ) { throw new Illega...
Finds the last entry of the address list and returns it as a property .
151,532
public static ModelNode getParentAddress ( final ModelNode address ) { if ( address . getType ( ) != ModelType . LIST ) { throw new IllegalArgumentException ( "The address type must be a list." ) ; } final ModelNode result = new ModelNode ( ) ; final List < Property > addressParts = address . asPropertyList ( ) ; if ( ...
Finds the parent address everything before the last address part .
151,533
public String getController ( ) { final StringBuilder controller = new StringBuilder ( ) ; if ( getProtocol ( ) != null ) { controller . append ( getProtocol ( ) ) . append ( "://" ) ; } if ( getHost ( ) != null ) { controller . append ( getHost ( ) ) ; } else { controller . append ( "localhost" ) ; } if ( getPort ( ) ...
Formats a connection string for CLI to use as it s controller connection .
151,534
static DefaultContainerDescription lookup ( final ModelControllerClient client ) throws IOException , OperationExecutionException { final ModelNode op = Operations . createReadResourceOperation ( new ModelNode ( ) . setEmptyList ( ) ) ; op . get ( ClientConstants . INCLUDE_RUNTIME ) . set ( true ) ; final ModelNode res...
Queries the running container and attempts to lookup the information from the running container .
151,535
public static SimpleDeploymentDescription of ( final String name , @ SuppressWarnings ( "TypeMayBeWeakened" ) final Set < String > serverGroups ) { final SimpleDeploymentDescription result = of ( name ) ; if ( serverGroups != null ) { result . addServerGroups ( serverGroups ) ; } return result ; }
Creates a simple deployment description .
151,536
protected void addBuildInfoProperties ( BuildInfoBuilder builder ) { if ( envVars != null ) { for ( Map . Entry < String , String > entry : envVars . entrySet ( ) ) { builder . addProperty ( BuildInfoProperties . BUILD_INFO_ENVIRONMENT_PREFIX + entry . getKey ( ) , entry . getValue ( ) ) ; } } if ( sysVars != null ) { ...
Adding environment and system variables to build info .
151,537
@ SuppressWarnings ( { "UnusedDeclaration" } ) public LoadBuildsResponse loadBuild ( String buildId ) { LoadBuildsResponse response = new LoadBuildsResponse ( ) ; setPromotionPlugin ( null ) ; try { this . currentPromotionCandidate = promotionCandidates . get ( buildId ) ; if ( this . currentPromotionCandidate == null ...
Load the related repositories plugins and a promotion config associated to the buildId . Called from the UI .
151,538
@ SuppressWarnings ( { "UnusedDeclaration" } ) public void doIndex ( StaplerRequest req , StaplerResponse resp ) throws IOException , ServletException { req . getView ( this , chooseAction ( ) ) . forward ( req , resp ) ; }
Select which view to display based on the state of the promotion . Will return the form if user selects to perform promotion . Progress will be returned if the promotion is currently in progress .
151,539
public static org . jfrog . hudson . ArtifactoryServer prepareArtifactoryServer ( String artifactoryServerID , ArtifactoryServer pipelineServer ) { if ( artifactoryServerID == null && pipelineServer == null ) { return null ; } if ( artifactoryServerID != null && pipelineServer != null ) { return null ; } if ( pipelineS...
Prepares Artifactory server either from serverID or from ArtifactoryServer .
151,540
public static BuildInfo appendBuildInfo ( CpsScript cpsScript , Map < String , Object > stepVariables ) { BuildInfo buildInfo = ( BuildInfo ) stepVariables . get ( BUILD_INFO ) ; if ( buildInfo == null ) { buildInfo = ( BuildInfo ) cpsScript . invokeMethod ( "newBuildInfo" , Maps . newLinkedHashMap ( ) ) ; stepVariable...
Add the buildInfo to step variables if missing and set its cps script .
151,541
public static boolean promoteAndCheckResponse ( Promotion promotion , ArtifactoryBuildInfoClient client , TaskListener listener , String buildName , String buildNumber ) throws IOException { if ( promotion . isFailFast ( ) ) { promotion . setDryRun ( true ) ; listener . getLogger ( ) . println ( "Performing dry run pro...
Two stage promotion dry run and actual promotion to verify correctness .
151,542
public static FormValidation validateEmails ( String emails ) { if ( ! Strings . isNullOrEmpty ( emails ) ) { String [ ] recipients = StringUtils . split ( emails , " " ) ; for ( String email : recipients ) { FormValidation validation = validateInternetAddress ( email ) ; if ( validation != FormValidation . ok ( ) ) { ...
Validates a space separated list of emails .
151,543
public static FormValidation validateArtifactoryCombinationFilter ( String value ) throws IOException , InterruptedException { String url = Util . fixEmptyAndTrim ( value ) ; if ( url == null ) return FormValidation . error ( "Mandatory field - You don`t have any deploy matches" ) ; return FormValidation . ok ( ) ; }
Validate the Combination filter field in Multi configuration jobs
151,544
public static boolean distributeAndCheckResponse ( DistributionBuilder distributionBuilder , ArtifactoryBuildInfoClient client , TaskListener listener , String buildName , String buildNumber , boolean dryRun ) throws IOException { listener . getLogger ( ) . println ( "Performing dry run distribution (no changes are mad...
Two stage distribution dry run and actual promotion to verify correctness .
151,545
private T getWrappedPublisher ( Publisher flexiblePublisher , Class < T > type ) { if ( ! ( flexiblePublisher instanceof FlexiblePublisher ) ) { throw new IllegalArgumentException ( String . format ( "Publisher should be of type: '%s'. Found type: '%s'" , FlexiblePublisher . class , flexiblePublisher . getClass ( ) ) )...
Gets the publisher wrapped by the specofoed FlexiblePublisher .
151,546
public T find ( AbstractProject < ? , ? > project , Class < T > type ) { if ( Jenkins . getInstance ( ) . getPlugin ( FLEXIBLE_PUBLISH_PLUGIN ) != null ) { for ( Publisher publisher : project . getPublishersList ( ) ) { if ( publisher instanceof FlexiblePublisher ) { T pub = getWrappedPublisher ( publisher , type ) ; i...
Gets the publisher of the specified type if it is wrapped by the Flexible Publish publisher in a project . Null is returned if no such publisher is found .
151,547
public boolean isPublisherWrapped ( AbstractProject < ? , ? > project , Class < T > type ) { return find ( project , type ) != null ; }
Determines whether a project has the specified publisher type wrapped by the Flexible Publish publisher .
151,548
public void commitWorkingCopy ( final String commitMessage ) throws IOException , InterruptedException { build . getWorkspace ( ) . act ( new SVNCommitWorkingCopyCallable ( commitMessage , getLocation ( ) , getSvnAuthenticationProvider ( build ) , buildListener ) ) ; }
Commits the working copy .
151,549
public void createTag ( final String tagUrl , final String commitMessage ) throws IOException , InterruptedException { build . getWorkspace ( ) . act ( new SVNCreateTagCallable ( tagUrl , commitMessage , getLocation ( ) , getSvnAuthenticationProvider ( build ) , buildListener ) ) ; }
Creates a tag directly from the working copy .
151,550
public void revertWorkingCopy ( ) throws IOException , InterruptedException { build . getWorkspace ( ) . act ( new RevertWorkingCopyCallable ( getLocation ( ) , getSvnAuthenticationProvider ( build ) , buildListener ) ) ; }
Revert all the working copy changes .
151,551
public void safeRevertWorkingCopy ( ) { try { revertWorkingCopy ( ) ; } catch ( Exception e ) { debuggingLogger . log ( Level . FINE , "Failed to revert working copy" , e ) ; log ( "Failed to revert working copy: " + e . getLocalizedMessage ( ) ) ; Throwable cause = e . getCause ( ) ; if ( ! ( cause instanceof SVNExcep...
Attempts to revert the working copy . In case of failure it just logs the error .
151,552
public void setIssueTrackerInfo ( BuildInfoBuilder builder ) { Issues issues = new Issues ( ) ; issues . setAggregateBuildIssues ( aggregateBuildIssues ) ; issues . setAggregationBuildStatus ( aggregationBuildStatus ) ; issues . setTracker ( new IssueTracker ( "JIRA" , issueTrackerVersion ) ) ; Set < Issue > affectedIs...
Apply issues tracker info to a build info builder ( used by generic tasks and maven2 which doesn t use the extractor
151,553
public static BuildRetention createBuildRetention ( Run build , boolean discardOldArtifacts ) { BuildRetention buildRetention = new BuildRetention ( discardOldArtifacts ) ; LogRotator rotator = null ; BuildDiscarder buildDiscarder = build . getParent ( ) . getBuildDiscarder ( ) ; if ( buildDiscarder != null && buildDis...
Create a Build retention object out of the build
151,554
public static String getImageIdFromTag ( String imageTag , String host ) throws IOException { DockerClient dockerClient = null ; try { dockerClient = getDockerClient ( host ) ; return dockerClient . inspectImageCmd ( imageTag ) . exec ( ) . getId ( ) ; } finally { closeQuietly ( dockerClient ) ; } }
Get image Id from imageTag using DockerBuildInfoHelper client .
151,555
public static void pushImage ( String imageTag , String username , String password , String host ) throws IOException { final AuthConfig authConfig = new AuthConfig ( ) ; authConfig . withUsername ( username ) ; authConfig . withPassword ( password ) ; DockerClient dockerClient = null ; try { dockerClient = getDockerCl...
Push docker image using the docker java client .
151,556
public static void pullImage ( String imageTag , String username , String password , String host ) throws IOException { final AuthConfig authConfig = new AuthConfig ( ) ; authConfig . withUsername ( username ) ; authConfig . withPassword ( password ) ; DockerClient dockerClient = null ; try { dockerClient = getDockerCl...
Pull docker image using the docker java client .
151,557
public static String getParentId ( String digest , String host ) throws IOException { DockerClient dockerClient = null ; try { dockerClient = getDockerClient ( host ) ; return dockerClient . inspectImageCmd ( digest ) . exec ( ) . getParent ( ) ; } finally { closeQuietly ( dockerClient ) ; } }
Get parent digest of an image .
151,558
public static List < String > getLayersDigests ( String manifestContent ) throws IOException { List < String > dockerLayersDependencies = new ArrayList < String > ( ) ; JsonNode manifest = Utils . mapper ( ) . readTree ( manifestContent ) ; JsonNode schemaVersion = manifest . get ( "schemaVersion" ) ; if ( schemaVersio...
Get a list of layer digests from docker manifest .
151,559
public static String digestToFileName ( String digest ) { if ( StringUtils . startsWith ( digest , "sha1" ) ) { return "manifest.json" ; } return getShaVersion ( digest ) + "__" + getShaValue ( digest ) ; }
Digest format to layer file name .
151,560
public static int getNumberOfDependentLayers ( String imageContent ) throws IOException { JsonNode history = Utils . mapper ( ) . readTree ( imageContent ) . get ( "history" ) ; if ( history == null ) { throw new IllegalStateException ( "Could not find 'history' tag" ) ; } int layersNum = history . size ( ) ; boolean n...
Returns number of dependencies layers in the image .
151,561
private List < String > getMavenModules ( MavenModuleSetBuild mavenBuild ) throws IOException , InterruptedException { FilePath pathToModuleRoot = mavenBuild . getModuleRoot ( ) ; FilePath pathToPom = new FilePath ( pathToModuleRoot , mavenBuild . getProject ( ) . getRootPOM ( null ) ) ; return pathToPom . act ( new Ma...
Retrieve from the parent pom the path to the modules of the project
151,562
private String getRelativePomPath ( MavenModule mavenModule , MavenModuleSetBuild mavenBuild ) { String relativePath = mavenModule . getRelativePath ( ) ; if ( StringUtils . isBlank ( relativePath ) ) { return POM_NAME ; } if ( mavenModule . getModuleName ( ) . toString ( ) . equals ( mavenBuild . getProject ( ) . getR...
Retrieve the relative path to the pom of the module
151,563
private String createPomPath ( String relativePath , String moduleName ) { if ( ! moduleName . contains ( ".xml" ) ) { return relativePath + "/" + POM_NAME ; } String dirName = relativePath . substring ( 0 , relativePath . indexOf ( "/" ) ) ; return dirName + "/" + moduleName ; }
Creates the actual path to the xml file of the module .
151,564
public List < String > invoke ( File f , VirtualChannel channel ) throws IOException , InterruptedException { MavenProject mavenProject = getMavenProject ( f . getAbsolutePath ( ) ) ; return mavenProject . getModel ( ) . getModules ( ) ; }
This is needed when running on slaves .
151,565
public static String getVcsRevision ( Map < String , String > env ) { String revision = env . get ( "SVN_REVISION" ) ; if ( StringUtils . isBlank ( revision ) ) { revision = env . get ( GIT_COMMIT ) ; } if ( StringUtils . isBlank ( revision ) ) { revision = env . get ( "P4_CHANGELIST" ) ; } return revision ; }
Get the VCS revision from the Jenkins build environment . The search will one of SVN_REVISION GIT_COMMIT P4_CHANGELIST in the environment .
151,566
public static String getVcsUrl ( Map < String , String > env ) { String url = env . get ( "SVN_URL" ) ; if ( StringUtils . isBlank ( url ) ) { url = publicGitUrl ( env . get ( "GIT_URL" ) ) ; } if ( StringUtils . isBlank ( url ) ) { url = env . get ( "P4PORT" ) ; } return url ; }
Get the VCS url from the Jenkins build environment . The search will one of SVN_REVISION GIT_COMMIT P4_CHANGELIST in the environment .
151,567
private static long daysBetween ( Date date1 , Date date2 ) { long diff ; if ( date2 . after ( date1 ) ) { diff = date2 . getTime ( ) - date1 . getTime ( ) ; } else { diff = date1 . getTime ( ) - date2 . getTime ( ) ; } return diff / ( 24 * 60 * 60 * 1000 ) ; }
Naive implementation of the difference in days between two dates
151,568
public static List < String > getBuildNumbersNotToBeDeleted ( Run build ) { List < String > notToDelete = Lists . newArrayList ( ) ; List < ? extends Run < ? , ? > > builds = build . getParent ( ) . getBuilds ( ) ; for ( Run < ? , ? > run : builds ) { if ( run . isKeepLog ( ) ) { notToDelete . add ( String . valueOf ( ...
Get the list of build numbers that are to be kept forever .
151,569
public static String entityToString ( HttpEntity entity ) throws IOException { if ( entity != null ) { InputStream is = entity . getContent ( ) ; return IOUtils . toString ( is , "UTF-8" ) ; } return "" ; }
Converts the http entity to string . If entity is null returns empty string .
151,570
public static FilePath createAndGetTempDir ( final FilePath ws ) throws IOException , InterruptedException { String workspaceList = System . getProperty ( "hudson.slaves.WorkspaceList" ) ; return ws . act ( new MasterToSlaveCallable < FilePath , IOException > ( ) { public FilePath call ( ) { final FilePath tempDir = ws...
Create a temporary directory under a given workspace
151,571
public boolean postExecute ( MavenBuildProxy build , MavenProject pom , MojoInfo mojo , BuildListener listener , Throwable error ) { recordMavenDependencies ( pom . getArtifacts ( ) ) ; return true ; }
Mojos perform different dependency resolution so we add dependencies for each mojo .
151,572
public boolean postBuild ( MavenBuildProxy build , MavenProject pom , BuildListener listener ) throws InterruptedException , IOException { build . executeAsync ( new BuildCallable < Void , IOException > ( ) { private final Set < MavenDependency > d = dependencies ; public Void call ( MavenBuild build ) throws IOExcepti...
Sends the collected dependencies over to the master and record them .
151,573
public static CredentialsConfig getPreferredDeployer ( DeployerOverrider deployerOverrider , ArtifactoryServer server ) { if ( deployerOverrider . isOverridingDefaultDeployer ( ) ) { CredentialsConfig deployerCredentialsConfig = deployerOverrider . getDeployerCredentialsConfig ( ) ; if ( deployerCredentialsConfig != nu...
Decides and returns the preferred deployment credentials to use from this builder settings and selected server
151,574
public boolean perform ( AbstractBuild < ? , ? > build , Launcher launcher , BuildListener listener ) throws InterruptedException , IOException { listener . getLogger ( ) . println ( "Jenkins Artifactory Plugin version: " + ActionableHelper . getArtifactoryPluginVersion ( ) ) ; EnvVars env = build . getEnvironment ( li...
Used by FreeStyle Maven jobs only
151,575
public boolean perform ( Run < ? , ? > build , Launcher launcher , TaskListener listener , EnvVars env , FilePath workDir , FilePath tempDir ) throws InterruptedException , IOException { listener . getLogger ( ) . println ( "Jenkins Artifactory Plugin version: " + ActionableHelper . getArtifactoryPluginVersion ( ) ) ; ...
Used by Pipeline jobs only
151,576
private FilePath copyClassWorldsFile ( FilePath ws , URL resource ) { try { FilePath remoteClassworlds = ws . createTextTempFile ( "classworlds" , "conf" , "" ) ; remoteClassworlds . copyFrom ( resource ) ; return remoteClassworlds ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Copies a classworlds file to a temporary location either on the local filesystem or on a slave depending on the node type .
151,577
public static < T extends Publisher > T getPublisher ( AbstractProject < ? , ? > project , Class < T > type ) { T publisher = new PublisherFindImpl < T > ( ) . find ( project , type ) ; if ( publisher != null ) { return publisher ; } publisher = new PublisherFlexible < T > ( ) . find ( project , type ) ; return publish...
Search for a publisher of the given type in a project and return it or null if it is not found .
151,578
public static String getArtifactoryPluginVersion ( ) { String pluginsSortName = "artifactory" ; if ( Jenkins . getInstance ( ) != null && Jenkins . getInstance ( ) . getPlugin ( pluginsSortName ) != null && Jenkins . getInstance ( ) . getPlugin ( pluginsSortName ) . getWrapper ( ) != null ) { return Jenkins . getInstan...
Returns the version of Jenkins Artifactory Plugin or empty string if not found
151,579
public static void deleteFilePath ( FilePath workspace , String path ) throws IOException { if ( StringUtils . isNotBlank ( path ) ) { try { FilePath propertiesFile = new FilePath ( workspace , path ) ; propertiesFile . delete ( ) ; } catch ( Exception e ) { throw new IOException ( "Could not delete temp file: " + path...
Deletes a FilePath file .
151,580
public String getRemoteUrl ( String defaultRemoteUrl ) { if ( StringUtils . isBlank ( defaultRemoteUrl ) ) { RemoteConfig remoteConfig = getJenkinsScm ( ) . getRepositories ( ) . get ( 0 ) ; URIish uri = remoteConfig . getURIs ( ) . get ( 0 ) ; return uri . toPrivateString ( ) ; } return defaultRemoteUrl ; }
This method is currently in use only by the SvnCoordinator
151,581
public String getRepoKey ( ) { String repoKey ; if ( isDynamicMode ( ) ) { repoKey = keyFromText ; } else { repoKey = keyFromSelect ; } return repoKey ; }
Used to get the current repository key
151,582
public void collectVariables ( EnvVars env , Run build , TaskListener listener ) { EnvVars buildParameters = Utils . extractBuildParameters ( build , listener ) ; if ( buildParameters != null ) { env . putAll ( buildParameters ) ; } addAllWithFilter ( envVars , env , filter . getPatternFilter ( ) ) ; Map < String , Str...
Collect environment variables and system properties under with filter constrains
151,583
protected void append ( Env env ) { addAllWithFilter ( this . envVars , env . envVars , filter . getPatternFilter ( ) ) ; addAllWithFilter ( this . sysVars , env . sysVars , filter . getPatternFilter ( ) ) ; }
Append environment variables and system properties from othre PipelineEvn object
151,584
private void addAllWithFilter ( Map < String , String > toMap , Map < String , String > fromMap , IncludeExcludePatterns pattern ) { for ( Object o : fromMap . entrySet ( ) ) { Map . Entry entry = ( Map . Entry ) o ; String key = ( String ) entry . getKey ( ) ; if ( PatternMatcher . pathConflicts ( key , pattern ) ) { ...
Adds all pairs from fromMap to toMap excluding once that matching the pattern
151,585
public void credentialsMigration ( T overrider , Class overriderClass ) { try { deployerMigration ( overrider , overriderClass ) ; resolverMigration ( overrider , overriderClass ) ; } catch ( NoSuchFieldException | IllegalAccessException | IOException e ) { converterErrors . add ( getConversionErrorMessage ( overrider ...
Migrate to Jenkins Credentials plugin from the old credential implementation
151,586
private ServerDetails createInitialResolveDetailsFromDeployDetails ( ServerDetails deployerDetails ) { RepositoryConf oldResolveRepositoryConfig = deployerDetails . getResolveReleaseRepository ( ) ; RepositoryConf oldSnapshotResolveRepositoryConfig = deployerDetails . getResolveSnapshotRepository ( ) ; RepositoryConf r...
Creates a new ServerDetails object for resolver this will take URL and name from the deployer ServerDetails as a default behaviour
151,587
private ServerDetails createInitialDeployDetailsFromOldDeployDetails ( ServerDetails oldDeployerDetails ) { RepositoryConf oldDeployRepositoryConfig = oldDeployerDetails . getDeployReleaseRepository ( ) ; RepositoryConf oldSnapshotDeployRepositoryConfig = oldDeployerDetails . getDeploySnapshotRepository ( ) ; Repositor...
Creates a new ServerDetails object for deployer this will take URL and name from the oldDeployer ServerDetails
151,588
private static Properties loadGradleProperties ( FilePath gradlePropertiesFilePath ) throws IOException , InterruptedException { return gradlePropertiesFilePath . act ( new MasterToSlaveFileCallable < Properties > ( ) { public Properties invoke ( File gradlePropertiesFile , VirtualChannel channel ) throws IOException ,...
Load a properties file from a file path
151,589
public Module generateBuildInfoModule ( Run build , TaskListener listener , ArtifactoryConfigurator config , String buildName , String buildNumber , String timestamp ) throws IOException { if ( artifactsProps == null ) { artifactsProps = ArrayListMultimap . create ( ) ; } artifactsProps . put ( "build.name" , buildName...
Generates the build - info module for this docker image . Additionally . this method tags the deployed docker layers with properties such as build . name build . number and custom properties defined in the Jenkins build .
151,590
private boolean findAndSetManifestFromArtifactory ( ArtifactoryServer server , ArtifactoryDependenciesClient dependenciesClient , TaskListener listener ) throws IOException { String candidateImagePath = DockerUtils . getImagePath ( imageTag ) ; String manifestPath ; manifestPath = StringUtils . join ( new String [ ] { ...
Find and validate manifest . json file in Artifactory for the current image . Since provided imageTag differs between reverse - proxy and proxy - less configuration try to build the correct manifest path .
151,591
private boolean checkAndSetManifestAndImagePathCandidates ( String manifestPath , String candidateImagePath , ArtifactoryDependenciesClient dependenciesClient , TaskListener listener ) throws IOException { String candidateManifest = getManifestFromArtifactory ( dependenciesClient , manifestPath ) ; if ( candidateManife...
Check if the provided manifestPath is correct . Set the manifest and imagePath in case of the correct manifest .
151,592
private List < org . jfrog . hudson . pipeline . types . File > getBuildFilesList ( Stream < ? extends BaseBuildFileBean > buildFilesStream ) { return buildFilesStream . filter ( buildFile -> StringUtils . isNotBlank ( buildFile . getLocalPath ( ) ) ) . filter ( buildFile -> StringUtils . isNotBlank ( buildFile . getRe...
Return a list of Files of downloaded or uploaded files . Filters build files without local and remote paths .
151,593
public List < Integer > getConnectionRetries ( ) { List < Integer > items = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 10 ; i ++ ) { items . add ( i ) ; } return items ; }
To populate the dropdown list from the jelly
151,594
public CredentialsConfig getResolvingCredentialsConfig ( ) { if ( resolverCredentialsConfig != null && resolverCredentialsConfig . isCredentialsProvided ( ) ) { return getResolverCredentialsConfig ( ) ; } if ( deployerCredentialsConfig != null ) { return getDeployerCredentialsConfig ( ) ; } return CredentialsConfig . E...
Decides what are the preferred credentials to use for resolving the repo keys of the server
151,595
public Boolean invoke ( File pomFile , VirtualChannel channel ) throws IOException , InterruptedException { org . jfrog . build . extractor . maven . reader . ModuleName current = new org . jfrog . build . extractor . maven . reader . ModuleName ( currentModule . groupId , currentModule . artifactId ) ; Map < org . jfr...
Performs the transformation .
151,596
public void edit ( int currentChangeListId , FilePath filePath ) throws Exception { establishConnection ( ) . editFile ( currentChangeListId , new File ( filePath . getRemote ( ) ) ) ; }
Opens file for editing .
151,597
private void convertJdkPath ( Launcher launcher , EnvVars extendedEnv ) { String separator = launcher . isUnix ( ) ? "/" : "\\" ; String java_home = extendedEnv . get ( "JAVA_HOME" ) ; if ( StringUtils . isNotEmpty ( java_home ) ) { if ( ! StringUtils . endsWith ( java_home , separator ) ) { java_home += separator ; } ...
The Maven3Builder class is looking for the PATH + JDK environment variable due to legacy code . In The pipeline flow we need to convert the JAVA_HOME to PATH + JDK in order to reuse the code .
151,598
public static AbstractBuild < ? , ? > getRootBuild ( AbstractBuild < ? , ? > currentBuild ) { AbstractBuild < ? , ? > rootBuild = null ; AbstractBuild < ? , ? > parentBuild = getUpstreamBuild ( currentBuild ) ; while ( parentBuild != null ) { if ( isPassIdentifiedDownstream ( parentBuild ) ) { rootBuild = parentBuild ;...
Get the root build which triggered the current build . The build root is considered to be the one furthest one away from the current build which has the isPassIdentifiedDownstream active if no parent build exists check that the current build needs an upstream identifier if it does return it .
151,599
private static AbstractProject < ? , ? > getProject ( String fullName ) { Item item = Hudson . getInstance ( ) . getItemByFullName ( fullName ) ; if ( item != null && item instanceof AbstractProject ) { return ( AbstractProject < ? , ? > ) item ; } return null ; }
Get a project according to its full name .