idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
27,800 | private void createResults ( List < ISuite > suites , File outputDirectory , boolean onlyShowFailures ) throws Exception { int index = 1 ; for ( ISuite suite : suites ) { int index2 = 1 ; for ( ISuiteResult result : suite . getResults ( ) . values ( ) ) { boolean failuresExist = result . getTestContext ( ) . getFailedT... | Generate a results file for each test in each suite . |
27,801 | private void copyResources ( File outputDirectory ) throws IOException { copyClasspathResource ( outputDirectory , "reportng.css" , "reportng.css" ) ; copyClasspathResource ( outputDirectory , "reportng.js" , "reportng.js" ) ; File customStylesheet = META . getStylesheetPath ( ) ; if ( customStylesheet != null ) { if (... | Reads the CSS and JavaScript files from the JAR file and writes them to the output directory . |
27,802 | public List < Throwable > getCauses ( Throwable t ) { List < Throwable > causes = new LinkedList < Throwable > ( ) ; Throwable next = t ; while ( next . getCause ( ) != null ) { next = next . getCause ( ) ; causes . add ( next ) ; } return causes ; } | Convert a Throwable into a list containing all of its causes . |
27,803 | private String commaSeparate ( Collection < String > strings ) { StringBuilder buffer = new StringBuilder ( ) ; Iterator < String > iterator = strings . iterator ( ) ; while ( iterator . hasNext ( ) ) { String string = iterator . next ( ) ; buffer . append ( string ) ; if ( iterator . hasNext ( ) ) { buffer . append ( ... | Takes a list of Strings and combines them into a single comma - separated String . |
27,804 | public String stripThreadName ( String threadId ) { if ( threadId == null ) { return null ; } else { int index = threadId . lastIndexOf ( '@' ) ; return index >= 0 ? threadId . substring ( 0 , index ) : threadId ; } } | TestNG returns a compound thread ID that includes the thread name and its numeric ID separated by an at sign . We only want to use the thread name as the ID is mostly unimportant and it takes up too much space in the generated report . |
27,805 | public long getStartTime ( List < IInvokedMethod > methods ) { long startTime = System . currentTimeMillis ( ) ; for ( IInvokedMethod method : methods ) { startTime = Math . min ( startTime , method . getDate ( ) ) ; } return startTime ; } | Find the earliest start time of the specified methods . |
27,806 | private long getEndTime ( ISuite suite , IInvokedMethod method ) { for ( Map . Entry < String , ISuiteResult > entry : suite . getResults ( ) . entrySet ( ) ) { ITestContext testContext = entry . getValue ( ) . getTestContext ( ) ; for ( ITestNGMethod m : testContext . getAllTestMethods ( ) ) { if ( method == m ) { ret... | Returns the timestamp for the time at which the suite finished executing . This is determined by finding the latest end time for each of the individual tests in the suite . |
27,807 | public void waitForBuffer ( long timeoutMilli ) { synchronized ( buffer ) { if ( dirtyBuffer ) return ; if ( ! foundEOF ( ) ) { logger . trace ( "Waiting for things to come in, or until timeout" ) ; try { if ( timeoutMilli > 0 ) buffer . wait ( timeoutMilli ) ; else buffer . wait ( ) ; } catch ( InterruptedException ie... | What is something came in between when we last checked and when this method is called |
27,808 | public static void main ( String args [ ] ) throws Exception { final StringBuffer buffer = new StringBuffer ( "The lazy fox" ) ; Thread t1 = new Thread ( ) { public void run ( ) { synchronized ( buffer ) { buffer . delete ( 0 , 4 ) ; buffer . append ( " in the middle" ) ; System . err . println ( "Middle" ) ; try { Thr... | We have more input since wait started |
27,809 | protected void notifyBufferChange ( char [ ] newData , int numChars ) { synchronized ( bufferChangeLoggers ) { Iterator < BufferChangeLogger > iterator = bufferChangeLoggers . iterator ( ) ; while ( iterator . hasNext ( ) ) { iterator . next ( ) . bufferChanged ( newData , numChars ) ; } } } | Notifies all registered BufferChangeLogger instances of a change . |
27,810 | 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 . |
27,811 | 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 . |
27,812 | 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 . |
27,813 | 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 . |
27,814 | 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 . |
27,815 | 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 . |
27,816 | 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 . |
27,817 | 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 . |
27,818 | 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 . |
27,819 | public Deployment setServerGroups ( final Collection < String > serverGroups ) { this . serverGroups . clear ( ) ; this . serverGroups . addAll ( serverGroups ) ; return this ; } | Sets the server groups for the deployment . |
27,820 | 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 . |
27,821 | 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 . |
27,822 | 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 |
27,823 | 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 . |
27,824 | public static ContainerDescription getContainerDescription ( final ModelControllerClient client ) throws IOException , OperationExecutionException { return DefaultContainerDescription . lookup ( Assert . checkNotNullParam ( "client" , client ) ) ; } | Returns the description of the running container . |
27,825 | 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 . |
27,826 | 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 . |
27,827 | 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 . |
27,828 | 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 . |
27,829 | 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 . |
27,830 | 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 . |
27,831 | 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 . |
27,832 | 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 . |
27,833 | public static UndeployDescription of ( final DeploymentDescription deploymentDescription ) { Assert . checkNotNullParam ( "deploymentDescription" , deploymentDescription ) ; return of ( deploymentDescription . getName ( ) ) . addServerGroups ( deploymentDescription . getServerGroups ( ) ) ; } | Creates a new undeploy description . |
27,834 | 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 . |
27,835 | 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 |
27,836 | 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 . |
27,837 | 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 . |
27,838 | 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 . |
27,839 | 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 . |
27,840 | 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 . |
27,841 | 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 . |
27,842 | 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 . |
27,843 | 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 . |
27,844 | 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 . |
27,845 | 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 . |
27,846 | 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 . |
27,847 | @ 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 . |
27,848 | @ 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 . |
27,849 | 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 . |
27,850 | 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 . |
27,851 | 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 . |
27,852 | 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 . |
27,853 | 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 |
27,854 | 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 . |
27,855 | 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 . |
27,856 | 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 . |
27,857 | 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 . |
27,858 | public void commitWorkingCopy ( final String commitMessage ) throws IOException , InterruptedException { build . getWorkspace ( ) . act ( new SVNCommitWorkingCopyCallable ( commitMessage , getLocation ( ) , getSvnAuthenticationProvider ( build ) , buildListener ) ) ; } | Commits the working copy . |
27,859 | 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 . |
27,860 | public void revertWorkingCopy ( ) throws IOException , InterruptedException { build . getWorkspace ( ) . act ( new RevertWorkingCopyCallable ( getLocation ( ) , getSvnAuthenticationProvider ( build ) , buildListener ) ) ; } | Revert all the working copy changes . |
27,861 | 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 . |
27,862 | 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 |
27,863 | 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 |
27,864 | 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 . |
27,865 | 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 . |
27,866 | 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 . |
27,867 | 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 . |
27,868 | 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 . |
27,869 | 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 . |
27,870 | 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 . |
27,871 | 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 |
27,872 | 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 |
27,873 | 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 . |
27,874 | 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 . |
27,875 | 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 . |
27,876 | 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 . |
27,877 | 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 |
27,878 | 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 . |
27,879 | 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 . |
27,880 | 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 |
27,881 | 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 . |
27,882 | 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 . |
27,883 | 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 |
27,884 | 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 |
27,885 | 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 |
27,886 | 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 . |
27,887 | 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 . |
27,888 | 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 |
27,889 | 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 . |
27,890 | 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 |
27,891 | public String getRepoKey ( ) { String repoKey ; if ( isDynamicMode ( ) ) { repoKey = keyFromText ; } else { repoKey = keyFromSelect ; } return repoKey ; } | Used to get the current repository key |
27,892 | 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 |
27,893 | 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 |
27,894 | 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 |
27,895 | 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 |
27,896 | 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 |
27,897 | 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 |
27,898 | 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 |
27,899 | 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 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.