buildkite-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1b6f6f72e11f8e14d2d9733ff117a82636b4acb0e328944a4ebdae19155c5aa9
4
+ data.tar.gz: 52b20845627a68c2c3cc537f2cf56ebd591e8b0272e89bea44a8f0360d30b128
5
+ SHA512:
6
+ metadata.gz: 5aad164d05ab9412ad990e592408975a40ad3ef859b779e6b90ac15f54c0946a19ec676e123fafa5cf6d54a3eaedbc5540d57614ccfce557e668699e9e626555
7
+ data.tar.gz: 466d0b6c5b5fc8b0abfb7d5177c089a7048f6da5d188c9cf2df69ad3844899b30271fadecdb956af66006ba15d4a5d3198082f1ff1d45097901d3452873f4e05
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,25 @@
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 3.0
7
+ # Exclude:
8
+ # - "lib/schema.rb"
9
+
10
+ Style/StringLiterals:
11
+ EnforcedStyle: double_quotes
12
+
13
+ Style/FrozenStringLiteralComment:
14
+ Enabled: false
15
+
16
+ Style/StringLiteralsInInterpolation:
17
+ EnforcedStyle: double_quotes
18
+
19
+ Metrics/LineLength:
20
+ Exclude:
21
+ - "lib/environment.rb"
22
+
23
+ Metrics/ModuleLength:
24
+ Exclude:
25
+ - "lib/environment.rb"
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Buildkite
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/buildkite`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/buildkite.
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "rubocop/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: %i[spec rubocop]
9
+
10
+ desc "Build the SDK into the dist directory."
11
+ task :build do
12
+ gemspec = "buildkite.gemspec"
13
+ target_dir = File.expand_path("../../dist/sdks/ruby", __dir__)
14
+
15
+ mkdir_p target_dir
16
+
17
+ sh "gem build #{gemspec}"
18
+ gem_file = Dir.glob("*.gem").max_by { |f| File.mtime(f) }
19
+ mv gem_file, File.join(target_dir, gem_file)
20
+
21
+ puts "Gem built and moved to: #{target_dir}"
22
+ end
data/env.mustache ADDED
@@ -0,0 +1,6 @@
1
+ module Environment
2
+ {{#variables}}
3
+ {{{comment}}}
4
+ {{name}} = "{{name}}"
5
+ {{/variables}}
6
+ end
@@ -0,0 +1,3 @@
1
+ module Buildkite
2
+ VERSION = "0.0.1".freeze
3
+ end
data/lib/buildkite.rb ADDED
@@ -0,0 +1,42 @@
1
+ require_relative "buildkite/version"
2
+ require_relative "environment"
3
+ require "json"
4
+ require "yaml"
5
+
6
+ module Buildkite
7
+ class Error < StandardError; end
8
+
9
+ # Here is a comment.
10
+ class Pipeline
11
+ def initialize
12
+ @steps = []
13
+ end
14
+
15
+ # Adds a step to the pipeline.
16
+ #
17
+ # @param [Buildkite::CommandStep, Buildkite::BlockStep] step
18
+ # The step to add, which can be either a CommandStep or a BlockStep.
19
+ # @return [self]
20
+ # Returns the pipeline itself for chaining.
21
+ #
22
+ # @example Adding a CommandStep
23
+ # command_step = Buildkite::CommandStep.new(label: "Run tests", commands: ["bundle exec rspec"])
24
+ # pipeline.add_step(command_step)
25
+ #
26
+ # @example Adding a BlockStep
27
+ # block_step = Buildkite::BlockStep.new(label: "Manual approval", block: "Deploy to production")
28
+ # pipeline.add_step(block_step)
29
+ def add_step(step)
30
+ @steps << step
31
+ self
32
+ end
33
+
34
+ def to_json(*_args)
35
+ JSON.pretty_generate({ steps: @steps }, indent: " ")
36
+ end
37
+
38
+ def to_yaml
39
+ { steps: @steps }.to_yaml
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,222 @@
1
+ module Environment
2
+ # Always `true`
3
+ BUILDKITE = "BUILDKITE".freeze
4
+ # The agent session token for the job. The variable is read by the agent `artifact` and `meta-data` commands.
5
+ BUILDKITE_AGENT_ACCESS_TOKEN = "BUILDKITE_AGENT_ACCESS_TOKEN".freeze
6
+ # The value of the `debug` [agent configuration option](/docs/agent/v3/configuration).
7
+ BUILDKITE_AGENT_DEBUG = "BUILDKITE_AGENT_DEBUG".freeze
8
+ # The value of the `disconnect-after-job` [agent configuration option](/docs/agent/v3/configuration).
9
+ BUILDKITE_AGENT_DISCONNECT_AFTER_JOB = "BUILDKITE_AGENT_DISCONNECT_AFTER_JOB".freeze
10
+ # The value of the `disconnect-after-idle-timeout` [agent configuration option](/docs/agent/v3/configuration).
11
+ BUILDKITE_AGENT_DISCONNECT_AFTER_IDLE_TIMEOUT = "BUILDKITE_AGENT_DISCONNECT_AFTER_IDLE_TIMEOUT".freeze
12
+ # The value of the `endpoint` [agent configuration option](/docs/agent/v3/configuration). This is set as an environment variable by the bootstrap and then read by most of the `buildkite-agent` commands.
13
+ BUILDKITE_AGENT_ENDPOINT = "BUILDKITE_AGENT_ENDPOINT".freeze
14
+ # A list of the [experimental agent features](/docs/agent/v3#experimental-features) that are currently enabled. The value can be set using the `--experiment` flag on the [`buildkite-agent start` command](/docs/agent/v3/cli-start#starting-an-agent) or in your [agent configuration file](/docs/agent/v3/configuration).
15
+ BUILDKITE_AGENT_EXPERIMENT = "BUILDKITE_AGENT_EXPERIMENT".freeze
16
+ # The value of the `health-check-addr` [agent configuration option](/docs/agent/v3/configuration).
17
+ BUILDKITE_AGENT_HEALTH_CHECK_ADDR = "BUILDKITE_AGENT_HEALTH_CHECK_ADDR".freeze
18
+ # The UUID of the agent.
19
+ BUILDKITE_AGENT_ID = "BUILDKITE_AGENT_ID".freeze
20
+ # The value of each [agent tag](/docs/agent/v3/cli-start#setting-tags). The tag name is appended to the end of the variable name. They can be set using the `--tags` flag on the `buildkite-agent start` command, or in the [agent configuration file](/docs/agent/v3/configuration). The [Queue tag](/docs/agent/v3/queues) is specifically used for isolating jobs and agents, and appears as the `BUILDKITE_AGENT_META_DATA_QUEUE` environment variable.
21
+ BUILDKITE_AGENT_META_DATA_ = "BUILDKITE_AGENT_META_DATA_".freeze
22
+ # The name of the agent that ran the job.
23
+ BUILDKITE_AGENT_NAME = "BUILDKITE_AGENT_NAME".freeze
24
+ # The process ID of the agent.
25
+ BUILDKITE_AGENT_PID = "BUILDKITE_AGENT_PID".freeze
26
+ # The artifact paths to upload after the job, if any have been specified. The value can be modified by exporting the environment variable in the `environment` or `pre-checkout` hooks.
27
+ BUILDKITE_ARTIFACT_PATHS = "BUILDKITE_ARTIFACT_PATHS".freeze
28
+ # The path where artifacts will be uploaded. This variable is read by the `buildkite-agent artifact upload` command, and during the artifact upload phase of [command steps](/docs/pipelines/command-step#command-step-attributes). It can only be set by exporting the environment variable in the `environment`, `pre-checkout` or `pre-command` hooks.
29
+ BUILDKITE_ARTIFACT_UPLOAD_DESTINATION = "BUILDKITE_ARTIFACT_UPLOAD_DESTINATION".freeze
30
+ # The path to the directory containing the `buildkite-agent` binary.
31
+ BUILDKITE_BIN_PATH = "BUILDKITE_BIN_PATH".freeze
32
+ # The branch being built. Note that for manually triggered builds, this branch is not guaranteed to contain the commit specified by `BUILDKITE_COMMIT`.
33
+ BUILDKITE_BRANCH = "BUILDKITE_BRANCH".freeze
34
+ # The path where the agent has checked out your code for this build. This variable is read by the bootstrap when the agent is started, and can only be set by exporting the environment variable in the `environment` or `pre-checkout` hooks.
35
+ BUILDKITE_BUILD_CHECKOUT_PATH = "BUILDKITE_BUILD_CHECKOUT_PATH".freeze
36
+ # The name of the user who authored the commit being built. May be **[unverified](#unverified-commits)**. This value can be blank in some situations, including builds manually triggered using API or Buildkite web interface.
37
+ BUILDKITE_BUILD_AUTHOR = "BUILDKITE_BUILD_AUTHOR".freeze
38
+ # The notification email of the user who authored the commit being built. May be **[unverified](#unverified-commits)**. This value can be blank in some situations, including builds manually triggered using API or Buildkite web interface.
39
+ BUILDKITE_BUILD_AUTHOR_EMAIL = "BUILDKITE_BUILD_AUTHOR_EMAIL".freeze
40
+ # The name of the user who created the build. The value differs depending on how the build was created:
41
+ #
42
+ # - **Buildkite dashboard:** Set based on who manually created the build.
43
+ # - **GitHub webhook:** Set from the **[unverified](#unverified-commits)** HEAD commit.
44
+ # - **Webhook:** Set based on which user is attached to the API Key used.
45
+ BUILDKITE_BUILD_CREATOR = "BUILDKITE_BUILD_CREATOR".freeze
46
+ # The notification email of the user who created the build. The value differs depending on how the build was created:
47
+ #
48
+ # - **Buildkite dashboard:** Set based on who manually created the build.
49
+ # - **GitHub webhook:** Set from the **[unverified](#unverified-commits)** HEAD commit.
50
+ # - **Webhook:** Set based on which user is attached to the API Key used.
51
+ BUILDKITE_BUILD_CREATOR_EMAIL = "BUILDKITE_BUILD_CREATOR_EMAIL".freeze
52
+ # A colon separated list of non-private team slugs that the build creator belongs to. The value differs depending on how the build was created:
53
+ #
54
+ # - **Buildkite dashboard:** Set based on who manually created the build.
55
+ # - **GitHub webhook:** Set from the **[unverified](#unverified-commits)** HEAD commit.
56
+ # - **Webhook:** Set based on which user is attached to the API Key used.
57
+ BUILDKITE_BUILD_CREATOR_TEAMS = "BUILDKITE_BUILD_CREATOR_TEAMS".freeze
58
+ # The UUID of the build.
59
+ BUILDKITE_BUILD_ID = "BUILDKITE_BUILD_ID".freeze
60
+ # The build number. This number increases with every build, and is guaranteed to be unique within each pipeline.
61
+ BUILDKITE_BUILD_NUMBER = "BUILDKITE_BUILD_NUMBER".freeze
62
+ # The value of the `build-path` [agent configuration option](/docs/agent/v3/configuration).
63
+ BUILDKITE_BUILD_PATH = "BUILDKITE_BUILD_PATH".freeze
64
+ # The url for this build on Buildkite.
65
+ BUILDKITE_BUILD_URL = "BUILDKITE_BUILD_URL".freeze
66
+ # The value of the `cancel-grace-period` [agent configuration option](/docs/agent/v3/configuration) in seconds.
67
+ BUILDKITE_CANCEL_GRACE_PERIOD = "BUILDKITE_CANCEL_GRACE_PERIOD".freeze
68
+ # The value of the `cancel-signal` [agent configuration option](/docs/agent/v3/configuration). The value can be modified by exporting the environment variable in the `environment` or `pre-checkout` hooks.
69
+ BUILDKITE_CANCEL_SIGNAL = "BUILDKITE_CANCEL_SIGNAL".freeze
70
+ # Whether the build should perform a clean checkout. The variable is read during the default checkout phase of the bootstrap and can be overridden in `environment` or `pre-checkout` hooks.
71
+ BUILDKITE_CLEAN_CHECKOUT = "BUILDKITE_CLEAN_CHECKOUT".freeze
72
+ # The UUID value of the cluster, but only if the build has an associated `cluster_queue`. Otherwise, this environment variable is not set.
73
+ BUILDKITE_CLUSTER_ID = "BUILDKITE_CLUSTER_ID".freeze
74
+ # The command that will be run for the job.
75
+ BUILDKITE_COMMAND = "BUILDKITE_COMMAND".freeze
76
+ # The opposite of the value of the `no-command-eval` [agent configuration option](/docs/agent/v3/configuration).
77
+ BUILDKITE_COMMAND_EVAL = "BUILDKITE_COMMAND_EVAL".freeze
78
+ # The exit code from the last command run in the command hook.
79
+ BUILDKITE_COMMAND_EXIT_STATUS = "BUILDKITE_COMMAND_EXIT_STATUS".freeze
80
+ # The git commit object of the build. This is usually a 40-byte hexadecimal SHA-1 hash, but can also be a symbolic name like `HEAD`.
81
+ BUILDKITE_COMMIT = "BUILDKITE_COMMIT".freeze
82
+ # The path to the agent config file.
83
+ BUILDKITE_CONFIG_PATH = "BUILDKITE_CONFIG_PATH".freeze
84
+ # The path to the file containing the job's environment variables.
85
+ BUILDKITE_ENV_FILE = "BUILDKITE_ENV_FILE".freeze
86
+ # The value of the `git-clean-flags` [agent configuration option](/docs/agent/v3/configuration). The value can be modified by exporting the environment variable in the `environment` or `pre-checkout` hooks.
87
+ BUILDKITE_GIT_CLEAN_FLAGS = "BUILDKITE_GIT_CLEAN_FLAGS".freeze
88
+ # The value of the `git-clone-flags` [agent configuration option](/docs/agent/v3/configuration). The value can be modified by exporting the environment variable in the `environment` or `pre-checkout` hooks.
89
+ BUILDKITE_GIT_CLONE_FLAGS = "BUILDKITE_GIT_CLONE_FLAGS".freeze
90
+ # The opposite of the value of the `no-git-submodules` [agent configuration option](/docs/agent/v3/configuration).
91
+ BUILDKITE_GIT_SUBMODULES = "BUILDKITE_GIT_SUBMODULES".freeze
92
+ # The GitHub deployment ID. Only available on builds triggered by a [GitHub Deployment](https://developer.github.com/v3/repos/deployments/).
93
+ BUILDKITE_GITHUB_DEPLOYMENT_ID = "BUILDKITE_GITHUB_DEPLOYMENT_ID".freeze
94
+ # The name of the GitHub deployment environment. Only available on builds triggered by a [GitHub Deployment](https://developer.github.com/v3/repos/deployments/).
95
+ BUILDKITE_GITHUB_DEPLOYMENT_ENVIRONMENT = "BUILDKITE_GITHUB_DEPLOYMENT_ENVIRONMENT".freeze
96
+ # The name of the GitHub deployment task. Only available on builds triggered by a [GitHub Deployment](https://developer.github.com/v3/repos/deployments/).
97
+ BUILDKITE_GITHUB_DEPLOYMENT_TASK = "BUILDKITE_GITHUB_DEPLOYMENT_TASK".freeze
98
+ # The GitHub deployment payload data as serialized JSON. Only available on builds triggered by a [GitHub Deployment](https://developer.github.com/v3/repos/deployments/).
99
+ BUILDKITE_GITHUB_DEPLOYMENT_PAYLOAD = "BUILDKITE_GITHUB_DEPLOYMENT_PAYLOAD".freeze
100
+ # The UUID of the [group step](/docs/pipelines/group-step) the job belongs to. This variable is only available if the job belongs to a group step.
101
+ BUILDKITE_GROUP_ID = "BUILDKITE_GROUP_ID".freeze
102
+ # The value of the `key` attribute of the [group step](/docs/pipelines/group-step) the job belongs to. This variable is only available if the job belongs to a group step.
103
+ BUILDKITE_GROUP_KEY = "BUILDKITE_GROUP_KEY".freeze
104
+ # The label/name of the [group step](/docs/pipelines/group-step) the job belongs to. This variable is only available if the job belongs to a group step.
105
+ BUILDKITE_GROUP_LABEL = "BUILDKITE_GROUP_LABEL".freeze
106
+ # The value of the `hooks-path` [agent configuration option](/docs/agent/v3/configuration).
107
+ BUILDKITE_HOOKS_PATH = "BUILDKITE_HOOKS_PATH".freeze
108
+ # A list of environment variables that have been set in your pipeline that are protected and will be overridden, used internally to pass data from the bootstrap to the agent.
109
+ BUILDKITE_IGNORED_ENV = "BUILDKITE_IGNORED_ENV".freeze
110
+ # The internal UUID Buildkite uses for this job.
111
+ BUILDKITE_JOB_ID = "BUILDKITE_JOB_ID".freeze
112
+ # The path to a temporary file containing the logs for this job. Requires enabling the `enable-job-log-tmpfile` [agent configuration option](/docs/agent/v3/configuration).
113
+ BUILDKITE_JOB_LOG_TMPFILE = "BUILDKITE_JOB_LOG_TMPFILE".freeze
114
+ # The label/name of the current job.
115
+ BUILDKITE_LABEL = "BUILDKITE_LABEL".freeze
116
+ # The exit code of the last hook that ran, used internally by the hooks.
117
+ BUILDKITE_LAST_HOOK_EXIT_STATUS = "BUILDKITE_LAST_HOOK_EXIT_STATUS".freeze
118
+ # The opposite of the value of the `no-local-hooks` [agent configuration option](/docs/agent/v3/configuration).
119
+ BUILDKITE_LOCAL_HOOKS_ENABLED = "BUILDKITE_LOCAL_HOOKS_ENABLED".freeze
120
+ # The message associated with the build, usually the commit message or the message provided when the build is triggered. The value is empty when a message is not set. For example, when a user triggers a build from the Buildkite dashboard without entering a message, the variable returns an empty value.
121
+ BUILDKITE_MESSAGE = "BUILDKITE_MESSAGE".freeze
122
+ # The UUID of the organization.
123
+ BUILDKITE_ORGANIZATION_ID = "BUILDKITE_ORGANIZATION_ID".freeze
124
+ # The organization name on Buildkite as used in URLs.
125
+ BUILDKITE_ORGANIZATION_SLUG = "BUILDKITE_ORGANIZATION_SLUG".freeze
126
+ # The index of each parallel job created from a parallel build step, starting from 0. For a build step with `parallelism: 5`, the value would be 0, 1, 2, 3, and 4 respectively.
127
+ BUILDKITE_PARALLEL_JOB = "BUILDKITE_PARALLEL_JOB".freeze
128
+ # The total number of parallel jobs created from a parallel build step. For a build step with `parallelism: 5`, the value is 5.
129
+ BUILDKITE_PARALLEL_JOB_COUNT = "BUILDKITE_PARALLEL_JOB_COUNT".freeze
130
+ # The default branch for this pipeline.
131
+ BUILDKITE_PIPELINE_DEFAULT_BRANCH = "BUILDKITE_PIPELINE_DEFAULT_BRANCH".freeze
132
+ # The UUID of the pipeline.
133
+ BUILDKITE_PIPELINE_ID = "BUILDKITE_PIPELINE_ID".freeze
134
+ # The displayed pipeline name on Buildkite.
135
+ BUILDKITE_PIPELINE_NAME = "BUILDKITE_PIPELINE_NAME".freeze
136
+ # The ID of the source code provider for the pipeline's repository.
137
+ BUILDKITE_PIPELINE_PROVIDER = "BUILDKITE_PIPELINE_PROVIDER".freeze
138
+ # The pipeline slug on Buildkite as used in URLs.
139
+ BUILDKITE_PIPELINE_SLUG = "BUILDKITE_PIPELINE_SLUG".freeze
140
+ # A colon separated list of the pipeline's non-private team slugs.
141
+ BUILDKITE_PIPELINE_TEAMS = "BUILDKITE_PIPELINE_TEAMS".freeze
142
+ # A JSON string holding the current plugin's configuration (as opposed to all the plugin configurations in the `BUILDKITE_PLUGINS` environment variable).
143
+ BUILDKITE_PLUGIN_CONFIGURATION = "BUILDKITE_PLUGIN_CONFIGURATION".freeze
144
+ # The current plugin's name, with all letters in uppercase and any spaces replaced with underscores.
145
+ BUILDKITE_PLUGIN_NAME = "BUILDKITE_PLUGIN_NAME".freeze
146
+ # A JSON object containing a list plugins used in the step, and their configuration.
147
+ BUILDKITE_PLUGINS = "BUILDKITE_PLUGINS".freeze
148
+ # The opposite of the value of the `no-plugins` [agent configuration option](/docs/agent/v3/configuration).
149
+ BUILDKITE_PLUGINS_ENABLED = "BUILDKITE_PLUGINS_ENABLED".freeze
150
+ # The value of the `plugins-path` [agent configuration option](/docs/agent/v3/configuration).
151
+ BUILDKITE_PLUGINS_PATH = "BUILDKITE_PLUGINS_PATH".freeze
152
+ # Whether to validate plugin configuration and requirements. The value can be modified by exporting the environment variable in the `environment` or `pre-checkout` hooks, or in a `pipeline.yml` file. It can also be enabled using the `no-plugin-validation` [agent configuration option](/docs/agent/v3/configuration).
153
+ BUILDKITE_PLUGIN_VALIDATION = "BUILDKITE_PLUGIN_VALIDATION".freeze
154
+ # The number of the pull request or `false` if not a pull request.
155
+ BUILDKITE_PULL_REQUEST = "BUILDKITE_PULL_REQUEST".freeze
156
+ # The base branch that the pull request is targeting or `""` if not a pull request.`
157
+ BUILDKITE_PULL_REQUEST_BASE_BRANCH = "BUILDKITE_PULL_REQUEST_BASE_BRANCH".freeze
158
+ # Set to `true` when the pull request is a draft. This variable is only available if a build contains a draft pull request.
159
+ BUILDKITE_PULL_REQUEST_DRAFT = "BUILDKITE_PULL_REQUEST_DRAFT".freeze
160
+ # The repository URL of the pull request or `""` if not a pull request.
161
+ BUILDKITE_PULL_REQUEST_REPO = "BUILDKITE_PULL_REQUEST_REPO".freeze
162
+ # The UUID of the original build this was rebuilt from or `""` if not a rebuild.
163
+ BUILDKITE_REBUILT_FROM_BUILD_ID = "BUILDKITE_REBUILT_FROM_BUILD_ID".freeze
164
+ # The number of the original build this was rebuilt from or `""` if not a rebuild.
165
+ BUILDKITE_REBUILT_FROM_BUILD_NUMBER = "BUILDKITE_REBUILT_FROM_BUILD_NUMBER".freeze
166
+ # A custom refspec for the buildkite-agent bootstrap script to use when checking out code. This variable can be modified by exporting the environment variable in the `environment` or `pre-checkout` hooks.
167
+ BUILDKITE_REFSPEC = "BUILDKITE_REFSPEC".freeze
168
+ # The repository of your pipeline. This variable can be set by exporting the environment variable in the `environment` or `pre-checkout` hooks.
169
+ BUILDKITE_REPO = "BUILDKITE_REPO".freeze
170
+ # The path to the shared git mirror. Introduced in [v3.47.0](https://github.com/buildkite/agent/releases/tag/v3.47.0).
171
+ BUILDKITE_REPO_MIRROR = "BUILDKITE_REPO_MIRROR".freeze
172
+ # How many times this job has been retried.
173
+ BUILDKITE_RETRY_COUNT = "BUILDKITE_RETRY_COUNT".freeze
174
+ # The access key ID for your S3 IAM user, for use with [private S3 buckets](/docs/agent/v3/cli-artifact#using-your-private-aws-s3-bucket). The variable is read by the `buildkite-agent artifact upload` command, and during the artifact upload phase of [command steps](/docs/pipelines/command-step#command-step-attributes). The value can only be set by exporting the environment variable in the `environment`, `pre-checkout` or `pre-command` hooks.
175
+ BUILDKITE_S3_ACCESS_KEY_ID = "BUILDKITE_S3_ACCESS_KEY_ID".freeze
176
+ # The access URL for your [private S3 bucket](/docs/agent/v3/cli-artifact#using-your-private-aws-s3-bucket), if you are using a proxy. The variable is read by the `buildkite-agent artifact upload` command, as well as during the artifact upload phase of [command steps](/docs/pipelines/command-step#command-step-attributes). The value can only be set by exporting the environment variable in the `environment`, `pre-checkout` or `pre-command` hooks.
177
+ BUILDKITE_S3_ACCESS_URL = "BUILDKITE_S3_ACCESS_URL".freeze
178
+ # The Access Control List to be set on artifacts being uploaded to your [private S3 bucket](/docs/agent/v3/cli-artifact#using-your-private-aws-s3-bucket). The variable is read by the `buildkite-agent artifact upload` command, as well as during the artifact upload phase of [command steps](/docs/pipelines/command-step#command-step-attributes). The value can only be set by exporting the environment variable in the `environment`, `pre-checkout` or `pre-command` hooks.
179
+ #
180
+ # Must be one of the following values which map to [S3 Canned ACL grants](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl).
181
+ BUILDKITE_S3_ACL = "BUILDKITE_S3_ACL".freeze
182
+ # The region of your [private S3 bucket](/docs/agent/v3/cli-artifact#using-your-private-aws-s3-bucket). The variable is read by the `buildkite-agent artifact upload` command, as well as during the artifact upload phase of [command steps](/docs/pipelines/command-step#command-step-attributes). The value can only be set by exporting the environment variable in the `environment`, `pre-checkout` or `pre-command` hooks.
183
+ BUILDKITE_S3_DEFAULT_REGION = "BUILDKITE_S3_DEFAULT_REGION".freeze
184
+ # The secret access key for your S3 IAM user, for use with [private S3 buckets](/docs/agent/v3/cli-artifact#using-your-private-aws-s3-bucket). The variable is read by the `buildkite-agent artifact upload` command, as well as during the artifact upload phase of [command steps](/docs/pipelines/command-step#command-step-attributes). The value can only be set by exporting the environment variable in the `environment`, `pre-checkout` or `pre-command` hooks. Do not print or export this variable anywhere except your agent hooks.
185
+ BUILDKITE_S3_SECRET_ACCESS_KEY = "BUILDKITE_S3_SECRET_ACCESS_KEY".freeze
186
+ # Whether to enable encryption for the artifacts in your [private S3 bucket](/docs/agent/v3/cli-artifact#using-your-private-aws-s3-bucket). The variable is read by the `buildkite-agent artifact upload` command, as well as during the artifact upload phase of [command steps](/docs/pipelines/command-step#command-step-attributes). The value can only be set by exporting the environment variable in the `environment`, `pre-checkout` or `pre-command` hooks.
187
+ BUILDKITE_S3_SSE_ENABLED = "BUILDKITE_S3_SSE_ENABLED".freeze
188
+ # The value of the `shell` [agent configuration option](/docs/agent/v3/configuration).
189
+ BUILDKITE_SHELL = "BUILDKITE_SHELL".freeze
190
+ # The source of the event that created the build.
191
+ BUILDKITE_SOURCE = "BUILDKITE_SOURCE".freeze
192
+ # The opposite of the value of the `no-ssh-keyscan` [agent configuration option](/docs/agent/v3/configuration).
193
+ BUILDKITE_SSH_KEYSCAN = "BUILDKITE_SSH_KEYSCAN".freeze
194
+ # A unique string that identifies a step.
195
+ BUILDKITE_STEP_ID = "BUILDKITE_STEP_ID".freeze
196
+ # The value of the `key` [command step attribute](/docs/pipelines/command-step#command-step-attributes), a unique string set by you to identify a step.
197
+ BUILDKITE_STEP_KEY = "BUILDKITE_STEP_KEY".freeze
198
+ # The name of the tag being built, if this build was triggered from a tag.
199
+ BUILDKITE_TAG = "BUILDKITE_TAG".freeze
200
+ # The number of minutes until Buildkite automatically cancels this job, if a timeout has been specified, otherwise it `false` if no timeout is set. Jobs that time out with an exit status of 0 are marked as "passed".
201
+ BUILDKITE_TIMEOUT = "BUILDKITE_TIMEOUT".freeze
202
+ # Set to `"datadog"` to send metrics to the [Datadog APM](https://docs.datadoghq.com/tracing/) using `localhost:8126`, or `DD_AGENT_HOST:DD_AGENT_APM_PORT`.
203
+ #
204
+ # Also available as a [buildkite agent configuration option.](/docs/agent/v3/configuration#configuration-settings)
205
+ BUILDKITE_TRACING_BACKEND = "BUILDKITE_TRACING_BACKEND".freeze
206
+ # The UUID of the build that triggered this build. This will be empty if the build was not triggered from another build.
207
+ BUILDKITE_TRIGGERED_FROM_BUILD_ID = "BUILDKITE_TRIGGERED_FROM_BUILD_ID".freeze
208
+ # The number of the build that triggered this build or `""` if the build was not triggered from another build.
209
+ BUILDKITE_TRIGGERED_FROM_BUILD_NUMBER = "BUILDKITE_TRIGGERED_FROM_BUILD_NUMBER".freeze
210
+ # The slug of the pipeline that was used to trigger this build or `""` if the build was not triggered from another build.
211
+ BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG = "BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG".freeze
212
+ # The name of the user who unblocked the build.
213
+ BUILDKITE_UNBLOCKER = "BUILDKITE_UNBLOCKER".freeze
214
+ # The notification email of the user who unblocked the build.
215
+ BUILDKITE_UNBLOCKER_EMAIL = "BUILDKITE_UNBLOCKER_EMAIL".freeze
216
+ # The UUID of the user who unblocked the build.
217
+ BUILDKITE_UNBLOCKER_ID = "BUILDKITE_UNBLOCKER_ID".freeze
218
+ # A colon separated list of non-private team slugs that the user who unblocked the build belongs to.
219
+ BUILDKITE_UNBLOCKER_TEAMS = "BUILDKITE_UNBLOCKER_TEAMS".freeze
220
+ # Always `true`.
221
+ CI = "CI".freeze
222
+ end
data/project.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "sdk-ruby",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "sdk/ruby",
5
+ "projectType": "library",
6
+ "tags": [],
7
+ "targets": {
8
+ "clean": {
9
+ "executor": "nx:run-commands",
10
+ "options": {
11
+ "commands": [
12
+ "rimraf .yardoc",
13
+ "rimraf .rspec_status",
14
+ "rimraf pkg"
15
+ ],
16
+ "cwd": "sdk/ruby"
17
+ },
18
+ "cache": false
19
+ },
20
+ "install": {
21
+ "executor": "nx:run-commands",
22
+ "options": {
23
+ "commands": ["bundle install"],
24
+ "cwd": "sdk/ruby"
25
+ },
26
+ "cache": false
27
+ },
28
+ "format": {
29
+ "executor": "nx:run-commands",
30
+ "options": {
31
+ "commands": ["bundle exec rubocop -A"],
32
+ "cwd": "sdk/ruby"
33
+ },
34
+ "cache": false
35
+ },
36
+ "build": {
37
+ "executor": "nx:run-commands",
38
+ "outputs": ["{projectRoot}/dist/sdks/ruby"],
39
+ "options": {
40
+ "commands": ["bundle exec rake build"],
41
+ "cwd": "sdk/ruby"
42
+ },
43
+ "cache": false
44
+ },
45
+ "publish": {
46
+ "executor": "nx:run-commands",
47
+ "options": {
48
+ "commands": ["gem push buildkite-sdk-$VERSION.gem"],
49
+ "cwd": "dist/sdks/ruby",
50
+ "env": {
51
+ "VERSION": "0.0.1"
52
+ }
53
+ },
54
+ "cache": false
55
+ },
56
+ "test": {
57
+ "executor": "nx:run-commands",
58
+ "options": {
59
+ "commands": ["bundle install", "bundle exec rspec spec"],
60
+ "cwd": "sdk/ruby"
61
+ },
62
+ "cache": false
63
+ },
64
+ "docs:build": {
65
+ "executor": "nx:run-commands",
66
+ "outputs": ["{workspaceRoot}/dist/docs/ruby"],
67
+ "options": {
68
+ "command": "bundle exec yard doc lib --output-dir ../../dist/docs/ruby",
69
+ "cwd": "sdk/ruby"
70
+ },
71
+ "cache": false
72
+ },
73
+ "docs:serve": {
74
+ "executor": "@nx/web:file-server",
75
+ "options": {
76
+ "port": 8082,
77
+ "buildTarget": "docs:build"
78
+ }
79
+ }
80
+ }
81
+ }
data/sig/buildkite.rbs ADDED
@@ -0,0 +1,26 @@
1
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
2
+ module Buildkite
3
+ VERSION: String
4
+
5
+ class CommandStep
6
+ attr_reader label: String
7
+ attr_reader commands: Array[String]
8
+ end
9
+
10
+ class BlockStep
11
+ attr_reader label: String
12
+ attr_reader block: String
13
+ end
14
+
15
+ class Pipeline
16
+ @steps: Array[CommandStep | BlockStep]
17
+
18
+ def initialize: () -> void
19
+
20
+ def add_step: (step: CommandStep | BlockStep) -> self
21
+
22
+ def to_json: () -> untyped
23
+
24
+ def to_yaml: () -> untyped
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: buildkite-sdk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Christian Nunciato
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-03-05 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: ostruct
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: 0.1.0
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: 0.1.0
26
+ description: A Ruby SDK for Buildkite!
27
+ email:
28
+ - chris.nunciato@buildkite.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".rspec"
34
+ - ".rubocop.yml"
35
+ - README.md
36
+ - Rakefile
37
+ - env.mustache
38
+ - lib/buildkite.rb
39
+ - lib/buildkite/version.rb
40
+ - lib/environment.rb
41
+ - project.json
42
+ - sig/buildkite.rbs
43
+ homepage: https://buildkite.com
44
+ licenses: []
45
+ metadata:
46
+ homepage_uri: https://buildkite.com
47
+ source_code_uri: https://github.com/buildkite/buildkite-sdk
48
+ changelog_uri: https://github.com/buildkite/buildkite-sdk
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 3.0.0
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubygems_version: 3.6.2
64
+ specification_version: 4
65
+ summary: A Ruby SDK for Buildkite!
66
+ test_files: []