Interface BuildRunnerContext

  • All Known Subinterfaces:
    BuildRunnerContextEx
    All Known Implementing Classes:
    BuildRunnerContextImpl

    @SystemProvided
    public interface BuildRunnerContext
    Represents current build runner. All update methods will modify current state. Modified state will be lost on the end of current running state.
    Since:
    6.0
    Author:
    Eugene Petrenko
    • Method Detail

      • getId

        String getId()
        Returns:
        build runner Id from server
        Since:
        8.0
      • getBuild

        @NotNull
        AgentRunningBuild getBuild()
        Return agent running build instance of current build runner context
        Returns:
        build from what this runner context was created
        Since:
        6.0
      • getWorkingDirectory

        @NotNull
        File getWorkingDirectory()
        Returns current runner working directory. This directory is expected to be set as working directory in a build process that build runner will start.
        Returns:
        path
        Since:
        6.0
      • getRunType

        @NotNull
        String getRunType()
        Returns:
        current runner type of the build
        Since:
        6.0
      • getName

        @NotNull
        String getName()
        Returns:
        build runner descriptor name, defined by the user
        Since:
        6.5
      • getBuildParameters

        @NotNull
        BuildParametersMap getBuildParameters()
        Returns current runner build parameters with all references expanded

        NOTE: Parameters may contain modifications for current state only

        Returns:
        see above
        Since:
        6.0
      • getConfigParameters

        @NotNull
        Map<String,​String> getConfigParameters()
        Returns current runner's configuration parameters with all references expanded
        Returns:
        see above
        Since:
        7.1
      • getRunnerParameters

        @NotNull
        Map<String,​String> getRunnerParameters()
        Returns unmodifiable map of runner parameters with all references expanded
        Returns:
        see above
        Since:
        6.0
      • addSystemProperty

        void addSystemProperty​(@NotNull
                               String key,
                               @NotNull
                               String value)
        Adds build system property ONTO this build runner state ONLY. Creates build parameters with Constants.SYSTEM_PREFIX prefix

        NOTE:. Modification will only affect current build runner state. Modifications will NOT be available in anther build runner states.

        Parameters:
        key - property name
        value - property value that may contain references
        Since:
        6.0
      • addEnvironmentVariable

        void addEnvironmentVariable​(@NotNull
                                    String key,
                                    @NotNull
                                    String value)
        Adds environment variable ONTO this build runner state ONLY. Creates build parameters with Constants.ENV_PREFIX prefix

        Note, on Windows machines environment size can be limited.

        NOTE:. Modification will only affect current build runner state. Modifications will NOT be available in anther build runner states.

        Parameters:
        key - name, may be case sensitive or not depending on OS
        value - value
        Since:
        6.0
      • addConfigParameter

        void addConfigParameter​(@NotNull
                                String key,
                                @NotNull
                                String value)
        Adds configuration parameter ONTO this build runner state ONLY.

        NOTE:. Modification will only affect current build runner state. Modifications will NOT be available in anther build runner states.

        Parameters:
        key - name, may be case sensitive or not depending on OS
        value - value
        Since:
        7.1
      • addRunnerParameter

        void addRunnerParameter​(@NotNull
                                String key,
                                @NotNull
                                String value)
        Adds runner parameter for current build runner. NOTE:. Modification will only affect current build runner state. Modifications will NOT be available in anther build runner states.
        Parameters:
        key - key
        value - value
        Since:
        6.0
      • getParametersResolver

        @NotNull
        ValueResolver getParametersResolver()
        Creates value resolver for parameters resolution in strings. The resolution rules are the same as for build parameters
        Returns:
        value resolver to perform resolution of all parameters references within string
        Since:
        6.0
      • parametersHaveReferencesTo

        boolean parametersHaveReferencesTo​(@NotNull
                                           Collection<String> keys)
        Finds usages of any of the given keys in all build and runner parameters
        Parameters:
        keys - the collection of keys
        Returns:
        true if a usage of any given keys is found
      • isVirtualContext

        boolean isVirtualContext()
        Returns:
        true if the given step will be run under a virtual environment (Docker) and the runner should not expect presence of tools non-bundled with the agent (located on build agent FS).
        Since:
        2018.1
      • getVirtualContext

        @NotNull
        VirtualContext getVirtualContext()
        Returns:
        current virtual context in the scope of build step
        Since:
        2019.2