Package hudson.slaves

Class WorkspaceList

    • Field Detail


        public static final String COMBINATOR
        The token that combines the project name and unique number to create unique workspace directory.

        public static final String TMP_DIR_SUFFIX
        Suffix for temporary folders.
    • Constructor Detail

      • WorkspaceList

        public WorkspaceList()
    • Method Detail

      • allocate

        public WorkspaceList.Lease allocate​(@NonNull
                                            FilePath base)
                                     throws InterruptedException
        Allocates a workspace by adding some variation to the given base to make it unique.

        This method doesn't block prolonged amount of time. Whenever a desired workspace is in use, the unique variation is added.

      • record

        public WorkspaceList.Lease record​(@NonNull
                                          FilePath p)
        Just record that this workspace is being used, without paying any attention to the synchronization support.
      • tempDir

        public static FilePath tempDir​(FilePath ws)
        Locates a conventional temporary directory to be associated with a workspace.

        This directory is suitable for temporary files to be deleted later in the course of a build, or caches and local repositories which should persist across builds done in the same workspace. (If multiple workspaces are present for a single job built concurrently, via allocate(FilePath), each will get its own temporary directory.)

        It may also be used for security-sensitive files which DirectoryBrowserSupport ought not serve, acknowledging that these will be readable by builds of other jobs done on the same node.

        Each plugin using this directory is responsible for specifying sufficiently unique subdirectory/file names. FilePath.createTempFile(java.lang.String, java.lang.String) may be used for this purpose if desired.

        The resulting directory may not exist; you may call FilePath.mkdirs() on it if you need it to. It may be deleted alongside the workspace itself during cleanup actions.

        ws - a directory such as a build workspace
        a sibling directory, for example …/something@tmp for …/something, or null if FilePath.getParent() is null