Sha256: 66f96f261e19aacb8116cc5f41fa733f32afd6b9fe429c72ed0ffcbb666c4f55

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

module Buildkit
  class Client
    # Methods for the Jobs API
    #
    # @see https://buildkite.com/docs/rest-api/jobs
    module Jobs
      # Retry a job
      #
      # @param org [String] Organization slug.
      # @param pipeline [String] Pipeline slug.
      # @param build [Integer] Build number.
      # @param job [String] Job id.
      # @return [Array<Sawyer::Resource>] Hashes representing Buildkite job.
      # @see https://buildkite.com/docs/rest-api/jobs#retry-a-job
      # @example
      #   Buildkit.retry_job('my-great-org', 'great-pipeline', 123, 'my-job-id')
      def retry_job(org, pipeline, build, job, options = {})
        put("/v2/organizations/#{org}/pipelines/#{pipeline}/builds/#{build}/jobs/#{job}/retry", options)
      end

      # Get a job's environment variables
      #
      # @param org [String] Organization slug.
      # @param pipeline [String] Pipeline slug.
      # @param build [Integer] Build number.
      # @param job [String] Job id.
      # @return [Array<Sawyer::Resource>] Hashes representing Buildkite job env.
      # @see https://buildkite.com/docs/rest-api/jobs#get-a-jobs-environment-variables
      # @example
      #   Buildkit.job_env('my-great-org', 'great-pipeline', 123, 'my-job-id')
      def job_env(org, pipeline, build, job, options = {})
        get("/v2/organizations/#{org}/pipelines/#{pipeline}/builds/#{build}/jobs/#{job}/env", options)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
buildkit-1.2.0 lib/buildkit/client/jobs.rb
buildkit-1.1.1 lib/buildkit/client/jobs.rb