Class Job.Builder

  • All Implemented Interfaces:
    software.amazon.jsii.Builder<Job>
    Enclosing interface:
    Job

    @Stability(Experimental)
    public static final class Job.Builder
    extends Object
    implements software.amazon.jsii.Builder<Job>
    A builder for Job
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • steps

        @Stability(Experimental)
        public Job.Builder steps​(List<? extends JobStep> steps)
        Sets the value of Job.getSteps()
        Parameters:
        steps - A job contains a sequence of tasks called steps. This parameter is required. Steps can run commands, run setup tasks, or run an action in your repository, a public repository, or an action published in a Docker registry. Not all steps run actions, but all actions run as a step. Each step runs in its own process in the runner environment and has access to the workspace and filesystem. Because steps run in their own process, changes to environment variables are not preserved between steps. GitHub provides built-in steps to set up and complete a job.
        Returns:
        this
      • container

        @Stability(Experimental)
        public Job.Builder container​(ContainerOptions container)
        Sets the value of Job.getContainer()
        Parameters:
        container - A container to run any steps in a job that don't already specify a container. If you have steps that use both script and container actions, the container actions will run as sibling containers on the same network with the same volume mounts.
        Returns:
        this
      • continueOnError

        @Stability(Experimental)
        public Job.Builder continueOnError​(Boolean continueOnError)
        Sets the value of Job.getContinueOnError()
        Parameters:
        continueOnError - Prevents a workflow run from failing when a job fails. Set to true to allow a workflow run to pass when this job fails.
        Returns:
        this
      • defaults

        @Stability(Experimental)
        public Job.Builder defaults​(JobDefaults defaults)
        Sets the value of Job.getDefaults()
        Parameters:
        defaults - A map of default settings that will apply to all steps in the job. You can also set default settings for the entire workflow.
        Returns:
        this
      • env

        @Stability(Experimental)
        public Job.Builder env​(Map<String,​String> env)
        Sets the value of Job.getEnv()
        Parameters:
        env - A map of environment variables that are available to all steps in the job. You can also set environment variables for the entire workflow or an individual step.
        Returns:
        this
      • environment

        @Stability(Experimental)
        public Job.Builder environment​(Object environment)
        Sets the value of Job.getEnvironment()
        Parameters:
        environment - The environment that the job references. All environment protection rules must pass before a job referencing the environment is sent to a runner.
        Returns:
        this
      • outputs

        @Stability(Experimental)
        public Job.Builder outputs​(Map<String,​? extends JobStepOutput> outputs)
        Sets the value of Job.getOutputs()
        Parameters:
        outputs - A map of outputs for a job. Job outputs are available to all downstream jobs that depend on this job.
        Returns:
        this
      • runsOn

        @Stability(Experimental)
        public Job.Builder runsOn​(List<String> runsOn)
        Sets the value of Job.getRunsOn()
        Parameters:
        runsOn - The type of machine to run the job on. The machine can be either a GitHub-hosted runner or a self-hosted runner.
        Returns:
        this
      • services

        @Stability(Experimental)
        public Job.Builder services​(Map<String,​? extends ContainerOptions> services)
        Sets the value of Job.getServices()
        Parameters:
        services - Used to host service containers for a job in a workflow. Service containers are useful for creating databases or cache services like Redis. The runner automatically creates a Docker network and manages the life cycle of the service containers.
        Returns:
        this
      • timeoutMinutes

        @Stability(Experimental)
        public Job.Builder timeoutMinutes​(Number timeoutMinutes)
        Sets the value of Job.getTimeoutMinutes()
        Parameters:
        timeoutMinutes - The maximum number of minutes to let a job run before GitHub automatically cancels it.
        Returns:
        this
      • tools

        @Stability(Experimental)
        public Job.Builder tools​(Tools tools)
        Sets the value of Job.getTools()
        Parameters:
        tools - Tools required for this job. Translates into actions/setup-xxx steps at the beginning of the job.
        Returns:
        this
      • permissions

        @Stability(Experimental)
        public Job.Builder permissions​(JobPermissions permissions)
        Parameters:
        permissions - You can modify the default permissions granted to the GITHUB_TOKEN, adding or removing access as required, so that you only allow the minimum required access. This parameter is required. Use { contents: READ } if your job only needs to clone code.

        This is intentionally a required field since it is required in order to allow workflows to run in GitHub repositories with restricted default access.

        Returns:
        this
      • concurrency

        @Stability(Experimental)
        public Job.Builder concurrency​(Object concurrency)
        Parameters:
        concurrency - Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the secrets context.
        Returns:
        this
      • ifValue

        @Stability(Experimental)
        public Job.Builder ifValue​(String ifValue)
        Parameters:
        ifValue - You can use the if conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional.
        Returns:
        this
      • needs

        @Stability(Experimental)
        public Job.Builder needs​(List<String> needs)
        Parameters:
        needs - Identifies any jobs that must complete successfully before this job will run. It can be a string or array of strings. If a job fails, all jobs that need it are skipped unless the jobs use a conditional expression that causes the job to continue.
        Returns:
        this
      • strategy

        @Stability(Experimental)
        public Job.Builder strategy​(JobStrategy strategy)
        Parameters:
        strategy - A strategy creates a build matrix for your jobs. You can define different variations to run each job in.
        Returns:
        this
      • build

        @Stability(Experimental)
        public Job build()
        Builds the configured instance.
        Specified by:
        build in interface software.amazon.jsii.Builder<Job>
        Returns:
        a new instance of Job
        Throws:
        NullPointerException - if any required attribute was not provided