Skip to content

Commit

Permalink
Add update-initial-pipelines script using buildkit
Browse files Browse the repository at this point in the history
  • Loading branch information
zzak committed Jun 23, 2023
1 parent 28588b0 commit c553dfd
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export BUILDKITE_TOKEN=changeme
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.envrc
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "buildkit"
25 changes: 25 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
buildkit (1.5.0)
sawyer (>= 0.6)
faraday (2.7.7)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
public_suffix (5.0.1)
ruby2_keywords (0.0.5)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)

PLATFORMS
arm64-darwin-23

DEPENDENCIES
buildkit

BUNDLED WITH
2.4.10
36 changes: 36 additions & 0 deletions update-initial-pipelines
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "buildkit"

def buildkite_token
ENV.fetch("BUILDKITE_TOKEN") {
raise "BUILDKITE_TOKEN undefined!"
}
end

def update_pipeline(pipeline, configuration)
client = Buildkit.new(token: buildkite_token)
resp = client.update_pipeline("rails", pipeline, {
configuration: configuration
})
puts resp.steps.to_s
end

# Update rails/rails
puts "Updating rails/rails..."
rails_init = File.read("rails-initial-pipeline.yml")
update_pipeline("rails", rails_init)

puts "\n" * 2; puts "#####"; puts "\n" * 2

# Update rails/rails-ci
puts "Updating rails/rails-ci..."
update_pipeline("rails-ci", rails_init)

puts "\n" * 2; puts "#####"; puts "\n" * 2

# Update rails/buildkite-config
puts "Updating rails/buildkite-config..."
buildkite_config_init = File.read("buildkite-config-initial-pipeline.yml")
update_pipeline("buildkite-config", buildkite_config_init)

0 comments on commit c553dfd

Please sign in to comment.