diff --git a/app/controllers/shipit/stacks_controller.rb b/app/controllers/shipit/stacks_controller.rb
index f2cc2ebcb..8090ff26f 100644
--- a/app/controllers/shipit/stacks_controller.rb
+++ b/app/controllers/shipit/stacks_controller.rb
@@ -154,7 +154,7 @@ def load_stack
end
def create_params
- params.require(:stack).permit(:repo_owner, :repo_name, :environment, :branch, :deploy_url, :ignore_ci)
+ params.require(:stack).permit(:repo_owner, :repo_name, :environment, :branch, :deploy_url, :ignore_ci, :path)
end
def update_params
diff --git a/app/models/shipit/stack.rb b/app/models/shipit/stack.rb
index 23767f254..f8a2dbfcb 100644
--- a/app/models/shipit/stack.rb
+++ b/app/models/shipit/stack.rb
@@ -415,7 +415,7 @@ def github_repo_name
def github_commits
handle_github_redirections do
- github_api.commits(github_repo_name, sha: branch)
+ github_api.commits(github_repo_name, sha: branch, path: path)
end
rescue Octokit::Conflict
[] # Repository is empty...
diff --git a/app/views/shipit/stacks/_settings_form.erb b/app/views/shipit/stacks/_settings_form.erb
index 7b0f6db35..030553e91 100644
--- a/app/views/shipit/stacks/_settings_form.erb
+++ b/app/views/shipit/stacks/_settings_form.erb
@@ -9,6 +9,12 @@
Branch: <%= stack.branch %>
+ <% if stack.path.present? %>
+
+ Path: <%= stack.path %>
+
+ <% end %>
+
<%= f.label :deploy_url, 'Deploy URL (Where is this stack deployed to?)' %>
<%= f.text_field :deploy_url, placeholder: 'https://' %>
diff --git a/app/views/shipit/stacks/new.html.erb b/app/views/shipit/stacks/new.html.erb
index eccc33c57..15e711bcc 100644
--- a/app/views/shipit/stacks/new.html.erb
+++ b/app/views/shipit/stacks/new.html.erb
@@ -23,6 +23,11 @@
<%= f.label :environment %>
<%= f.text_field :environment, placeholder: 'production' %>
+
+ <%= f.label :path %>
+ Only track a subpath of this repo?
+ <%= f.text_field :path, placeholder: '/' %>
+
<%= f.label :deploy_url %>
Where is this stack deployed to?
diff --git a/db/migrate/20240919171423_add_path_to_stack.rb b/db/migrate/20240919171423_add_path_to_stack.rb
new file mode 100644
index 000000000..07171f3b2
--- /dev/null
+++ b/db/migrate/20240919171423_add_path_to_stack.rb
@@ -0,0 +1,5 @@
+class AddPathToStack < ActiveRecord::Migration[7.2]
+ def change
+ add_column :stacks, :path, :string
+ end
+end
diff --git a/dev.yml b/dev.yml
index 2dfd802fa..8801ec910 100644
--- a/dev.yml
+++ b/dev.yml
@@ -8,6 +8,7 @@ up:
- packages:
- sqlite
- ruby
+ - redis
- isogun
- bundler:
without: ci
diff --git a/lib/shipit.rb b/lib/shipit.rb
index 112691745..18b74a57e 100644
--- a/lib/shipit.rb
+++ b/lib/shipit.rb
@@ -95,7 +95,7 @@ def app_name
end
def redis_url
- secrets.redis_url.present? ? URI(secrets.redis_url) : nil
+ secrets.redis_url.present? ? URI(secrets.redis_url) : ENV["REDIS_URL"]
end
def redis
diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb
index 22bbfaffb..a2975cffb 100644
--- a/test/dummy/db/schema.rb
+++ b/test/dummy/db/schema.rb
@@ -10,8 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2023_07_03_181143) do
-
+ActiveRecord::Schema[7.2].define(version: 2024_09_19_171423) do
create_table "api_clients", force: :cascade do |t|
t.text "permissions", limit: 65535
t.integer "creator_id", limit: 4
@@ -197,8 +196,8 @@
t.integer "user_id"
t.text "labels"
t.integer "head_id"
- t.datetime "created_at", precision: 6, null: false
- t.datetime "updated_at", precision: 6, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.index ["head_id"], name: "index_pull_requests_on_head_id"
t.index ["stack_id", "github_id"], name: "index_pull_requests_on_stack_id_and_github_id", unique: true
t.index ["stack_id", "number"], name: "index_pull_requests_on_stack_id_and_number", unique: true
@@ -223,8 +222,8 @@
create_table "repositories", force: :cascade do |t|
t.string "owner", limit: 39, null: false
t.string "name", limit: 100, null: false
- t.datetime "created_at", precision: 6, null: false
- t.datetime "updated_at", precision: 6, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.boolean "review_stacks_enabled", default: false
t.string "provisioning_behavior", default: "allow_all"
t.string "provisioning_label_name"
@@ -255,6 +254,7 @@
t.string "provision_status", default: "deprovisioned", null: false
t.string "type", default: "Shipit::Stack"
t.boolean "awaiting_provision", default: false, null: false
+ t.string "path"
t.index ["archived_since"], name: "index_stacks_on_archived_since"
t.index ["awaiting_provision"], name: "index_stacks_on_awaiting_provision"
t.index ["provision_status"], name: "index_stacks_on_provision_status"
@@ -338,5 +338,4 @@
t.index ["login"], name: "index_users_on_login"
t.index ["updated_at"], name: "index_users_on_updated_at"
end
-
end