shipit-engine 0.7.0 → 0.8.0
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 +4 -4
- data/README.md +50 -2
- data/app/assets/stylesheets/_pages/_deploy.scss +3 -2
- data/app/controllers/shipit/api/base_controller.rb +5 -0
- data/app/controllers/shipit/api/deploys_controller.rb +2 -1
- data/app/controllers/shipit/api/tasks_controller.rb +4 -1
- data/app/controllers/shipit/deploys_controller.rb +1 -1
- data/app/controllers/shipit/github_authentication_controller.rb +4 -2
- data/app/controllers/shipit/rollbacks_controller.rb +1 -1
- data/app/controllers/shipit/tasks_controller.rb +14 -2
- data/app/helpers/shipit/github_url_helper.rb +4 -2
- data/app/helpers/shipit/stacks_helper.rb +3 -3
- data/app/jobs/shipit/continuous_delivery_job.rb +12 -0
- data/app/jobs/shipit/create_on_github_job.rb +11 -0
- data/app/jobs/shipit/fetch_deployed_revision_job.rb +1 -1
- data/app/models/shipit/anonymous_user.rb +4 -0
- data/app/models/shipit/commit.rb +8 -10
- data/app/models/shipit/commit_deployment.rb +56 -0
- data/app/models/shipit/commit_deployment_status.rb +57 -0
- data/app/models/shipit/deploy.rb +32 -6
- data/app/models/shipit/deploy_spec.rb +8 -0
- data/app/models/shipit/deploy_spec/rubygems_discovery.rb +1 -1
- data/app/models/shipit/rollback.rb +10 -0
- data/app/models/shipit/stack.rb +30 -12
- data/app/models/shipit/status_group.rb +1 -1
- data/app/models/shipit/task.rb +1 -0
- data/app/models/shipit/task_definition.rb +20 -1
- data/app/models/shipit/user.rb +10 -2
- data/app/models/shipit/variable_definition.rb +2 -4
- data/app/serializers/shipit/commit_serializer.rb +19 -1
- data/app/serializers/shipit/deploy_serializer.rb +7 -1
- data/app/serializers/shipit/short_commit_serializer.rb +1 -1
- data/app/serializers/shipit/task_serializer.rb +17 -1
- data/app/views/shipit/_variables.html.erb +15 -0
- data/app/views/shipit/deploys/_concurrent_deploy_warning.html.erb +1 -1
- data/app/views/shipit/deploys/_deploy.html.erb +2 -2
- data/app/views/shipit/deploys/new.html.erb +3 -17
- data/app/views/shipit/deploys/rollback.html.erb +3 -17
- data/app/views/shipit/tasks/new.html.erb +12 -4
- data/config/locales/en.yml +11 -0
- data/db/migrate/20160210183823_add_allow_concurrency_to_tasks.rb +5 -0
- data/db/migrate/20160303163611_create_shipit_commit_deployments.rb +14 -0
- data/db/migrate/20160303170913_create_shipit_commit_deployment_statuses.rb +12 -0
- data/db/migrate/20160303203940_add_encrypted_token_to_users.rb +6 -0
- data/lib/shipit.rb +7 -1
- data/lib/shipit/engine.rb +3 -1
- data/lib/shipit/environment_variables.rb +34 -0
- data/lib/shipit/simple_message_verifier.rb +0 -1
- data/lib/shipit/task_commands.rb +1 -0
- data/lib/shipit/version.rb +1 -1
- data/test/controllers/api/deploys_controller_test.rb +15 -0
- data/test/controllers/api/tasks_controller_test.rb +15 -0
- data/test/controllers/github_authentication_controller_test.rb +23 -5
- data/test/controllers/tasks_controller_test.rb +27 -2
- data/test/controllers/webhooks_controller_test.rb +8 -2
- data/test/dummy/config/database.mysql.yml +1 -1
- data/test/dummy/config/secrets.example.yml +2 -2
- data/test/dummy/config/secrets.yml +2 -2
- data/test/dummy/data/stacks/byroot/junk/production/git/bar.txt +1 -0
- data/test/dummy/data/stacks/byroot/junk/production/git/dkfdsf +0 -0
- data/test/dummy/data/stacks/byroot/junk/production/git/dskjfsd +0 -0
- data/test/dummy/data/stacks/byroot/junk/production/git/dslkjfjsdf +0 -0
- data/test/dummy/data/stacks/byroot/junk/production/git/plopfizz +0 -0
- data/test/dummy/data/stacks/byroot/junk/production/git/sd +0 -0
- data/test/dummy/data/stacks/byroot/junk/production/git/sdkfjsdf +1 -0
- data/test/dummy/data/stacks/byroot/junk/production/git/sdlfjsdfdsfj +0 -0
- data/test/dummy/data/stacks/byroot/junk/production/git/sdlkfjsdlkfjsdlkfjdsfsdfksdfjsldkfjsdlkfjsdf +0 -0
- data/test/dummy/data/stacks/byroot/junk/production/git/shipit.yml +27 -0
- data/test/dummy/data/stacks/byroot/junk/production/git/toto.txt +2 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +35 -7
- data/test/dummy/db/seeds.rb +3 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/fixtures/shipit/commit_deployment_statuses.yml +19 -0
- data/test/fixtures/shipit/commit_deployments.yml +37 -0
- data/test/fixtures/shipit/commits.yml +1 -1
- data/test/fixtures/shipit/stacks.yml +12 -0
- data/test/fixtures/shipit/tasks.yml +4 -0
- data/test/fixtures/shipit/users.yml +2 -0
- data/test/jobs/fetch_deployed_revision_job_test.rb +3 -3
- data/test/models/commit_deployment_status_test.rb +27 -0
- data/test/models/commit_deployment_test.rb +37 -0
- data/test/models/commits_test.rb +7 -4
- data/test/models/deploys_test.rb +17 -1
- data/test/models/stacks_test.rb +13 -13
- data/test/models/task_definitions_test.rb +10 -0
- data/test/models/team_test.rb +8 -2
- data/test/models/users_test.rb +20 -2
- data/test/unit/deploy_spec_test.rb +29 -0
- data/test/unit/environment_variables_test.rb +36 -0
- data/test/unit/github_url_helper_test.rb +0 -8
- metadata +76 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<section class="warning concurrent-deploy">
|
|
2
|
-
<h2><%= render_github_user(@stack.
|
|
2
|
+
<h2><%= render_github_user(@stack.active_task.author) %> is already deploying!</h2>
|
|
3
3
|
<ul>
|
|
4
4
|
<li>Are you sure you want to deploy concurrently?</li>
|
|
5
5
|
<li>
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
<% unless read_only %>
|
|
24
24
|
<div class="commit-actions">
|
|
25
25
|
<% if deploy.rollbackable? %>
|
|
26
|
-
<% if deploy.stack.
|
|
26
|
+
<% if deploy.stack.active_task? %>
|
|
27
27
|
<%= link_to 'Deploy in progress...', '#', class: 'btn disabled deploy-action' %>
|
|
28
28
|
<% else %>
|
|
29
29
|
<%= link_to 'Rollback to this deploy...', rollback_stack_deploy_path(@stack, deploy), class: 'btn btn--delete deploy-action rollback-action' %>
|
|
30
30
|
<% end %>
|
|
31
|
-
<% elsif deploy.currently_deployed? && !deploy.stack.
|
|
31
|
+
<% elsif deploy.currently_deployed? && !deploy.stack.active_task? %>
|
|
32
32
|
<%= redeploy_button(deploy.until_commit) %>
|
|
33
33
|
<% end %>
|
|
34
34
|
</div>
|
|
@@ -28,23 +28,9 @@
|
|
|
28
28
|
<%= render_checklist @stack.checklist %>
|
|
29
29
|
|
|
30
30
|
<%= form_for [@stack, @deploy] do |f| %>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<h2>Environment variables</h2>
|
|
35
|
-
</header>
|
|
36
|
-
<%= f.fields_for :env do |env_fields| %>
|
|
37
|
-
<% @deploy.variables.each do |variable| %>
|
|
38
|
-
<p class="environment-variable">
|
|
39
|
-
<%= env_fields.text_field variable.name, value: variable.default %>
|
|
40
|
-
<%= env_fields.label variable.name, variable.title || variable.name %>
|
|
41
|
-
</p>
|
|
42
|
-
<% end %>
|
|
43
|
-
<% end %>
|
|
44
|
-
</section>
|
|
45
|
-
<% end %>
|
|
46
|
-
|
|
47
|
-
<%= render 'concurrent_deploy_warning' if @stack.deploying? %>
|
|
31
|
+
<%= render partial: 'shipit/variables', locals: { variables: @deploy.variables, form: f, header: "Environment Variables", field_name: :env} %>
|
|
32
|
+
|
|
33
|
+
<%= render 'concurrent_deploy_warning' if @stack.active_task? %>
|
|
48
34
|
|
|
49
35
|
<section class="submit-section">
|
|
50
36
|
<%= f.hidden_field :until_commit_id %>
|
|
@@ -24,23 +24,9 @@
|
|
|
24
24
|
<%= render_checklist @stack.checklist %>
|
|
25
25
|
|
|
26
26
|
<%= form_for [@stack, @rollback] do |f| %>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<h2>Environment variables</h2>
|
|
31
|
-
</header>
|
|
32
|
-
<%= f.fields_for :env do |env_fields| %>
|
|
33
|
-
<% @rollback.variables.each do |variable| %>
|
|
34
|
-
<p class="environment-variable">
|
|
35
|
-
<%= env_fields.text_field variable.name, value: variable.default %>
|
|
36
|
-
<%= env_fields.label variable.name, variable.title || variable.name %>
|
|
37
|
-
</p>
|
|
38
|
-
<% end %>
|
|
39
|
-
<% end %>
|
|
40
|
-
</section>
|
|
41
|
-
<% end %>
|
|
42
|
-
|
|
43
|
-
<%= render 'concurrent_deploy_warning' if @stack.deploying? %>
|
|
27
|
+
<%= render partial: 'shipit/variables', locals: { variables: @rollback.variables, form: f, header: "Environment Variables", field_name: :env} %>
|
|
28
|
+
|
|
29
|
+
<%= render 'concurrent_deploy_warning' if @stack.active_task? %>
|
|
44
30
|
|
|
45
31
|
<section class="submit-section">
|
|
46
32
|
<%= f.hidden_field :parent_id %>
|
|
@@ -13,9 +13,17 @@
|
|
|
13
13
|
|
|
14
14
|
<%= render_checklist @task.checklist %>
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
<%= form_for @task, url: stack_tasks_path(@stack, definition_id: @task.definition.id) do |f| %>
|
|
17
|
+
|
|
18
|
+
<%= render partial: 'shipit/variables', locals: { variables: @task.definition.variables, form: f, header: "Environment Variables", field_name: :env} %>
|
|
19
|
+
|
|
20
|
+
<section class="submit-section">
|
|
21
|
+
<% if !@task.definition.allow_concurrency? && @stack.active_task? %>
|
|
22
|
+
<%= render 'shipit/deploys/concurrent_deploy_warning' %>
|
|
23
|
+
<% end %>
|
|
24
|
+
|
|
18
25
|
<%= f.submit @task.definition.action, :class => ['btn', 'primary', 'trigger-deploy'] %>
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
</section>
|
|
27
|
+
|
|
28
|
+
<% end %>
|
|
21
29
|
</div>
|
data/config/locales/en.yml
CHANGED
|
@@ -52,3 +52,14 @@ en:
|
|
|
52
52
|
messages:
|
|
53
53
|
subset: "is not a strict subset of %{of}"
|
|
54
54
|
ascii: "contains non-ASCII characters"
|
|
55
|
+
deployment_description:
|
|
56
|
+
deploy:
|
|
57
|
+
pending: "%{author} triggered the deploy of %{stack} to %{sha}"
|
|
58
|
+
success: "%{author} deployed %{stack} to %{sha}"
|
|
59
|
+
failure: "Deploy of %{stack} to %{sha} by %{author} failed"
|
|
60
|
+
error: "Deploy of %{stack} to %{sha} by %{author} failed"
|
|
61
|
+
rollback:
|
|
62
|
+
pending: "%{author} triggered the rollback of %{stack} to %{sha}"
|
|
63
|
+
success: "%{author} rolled back %{stack} to %{sha}"
|
|
64
|
+
failure: "Rollback of %{stack} to %{sha} by %{author} failed"
|
|
65
|
+
error: "Rollback of %{stack} to %{sha} by %{author} failed"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class CreateShipitCommitDeployments < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :commit_deployments do |t|
|
|
4
|
+
t.references :commit, foreign_key: true
|
|
5
|
+
t.references :task, index: true, foreign_key: true
|
|
6
|
+
t.integer :github_id, null: true
|
|
7
|
+
t.string :api_url, null: true
|
|
8
|
+
|
|
9
|
+
t.timestamps null: false
|
|
10
|
+
|
|
11
|
+
t.index %i(commit_id task_id), unique: true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class CreateShipitCommitDeploymentStatuses < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :commit_deployment_statuses do |t|
|
|
4
|
+
t.references :commit_deployment, index: true, foreign_key: true
|
|
5
|
+
t.string :status
|
|
6
|
+
t.integer :github_id
|
|
7
|
+
t.string :api_url
|
|
8
|
+
|
|
9
|
+
t.timestamps null: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/shipit.rb
CHANGED
|
@@ -4,6 +4,7 @@ require 'state_machines-activerecord'
|
|
|
4
4
|
require 'validate_url'
|
|
5
5
|
require 'responders'
|
|
6
6
|
require 'explicit-parameters'
|
|
7
|
+
require 'attr_encrypted'
|
|
7
8
|
|
|
8
9
|
require 'sass-rails'
|
|
9
10
|
require 'coffee-rails'
|
|
@@ -37,6 +38,7 @@ require 'shipit/stack_commands'
|
|
|
37
38
|
require 'shipit/task_commands'
|
|
38
39
|
require 'shipit/deploy_commands'
|
|
39
40
|
require 'shipit/rollback_commands'
|
|
41
|
+
require 'shipit/environment_variables'
|
|
40
42
|
|
|
41
43
|
SafeYAML::OPTIONS[:default_mode] = :safe
|
|
42
44
|
SafeYAML::OPTIONS[:deserialize_symbols] = false
|
|
@@ -96,7 +98,11 @@ module Shipit
|
|
|
96
98
|
end
|
|
97
99
|
|
|
98
100
|
def api_clients_secret
|
|
99
|
-
secrets.api_clients_secret ||
|
|
101
|
+
secrets.api_clients_secret.presence || secrets.secret_key_base
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def user_access_tokens_key
|
|
105
|
+
secrets.user_access_tokens_key.presence || secrets.secret_key_base
|
|
100
106
|
end
|
|
101
107
|
|
|
102
108
|
def host
|
data/lib/shipit/engine.rb
CHANGED
|
@@ -18,6 +18,8 @@ module Shipit
|
|
|
18
18
|
path =~ /\Aplugins\/[\-\w]+\.(js|css)\Z/
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
ActionDispatch::ExceptionWrapper.rescue_responses[Shipit::TaskDefinition::NotFound.name] = :not_found
|
|
22
|
+
|
|
21
23
|
ActiveModel::Serializer._root = false
|
|
22
24
|
ActiveModel::ArraySerializer._root = false
|
|
23
25
|
ActiveModel::Serializer.include(Engine.routes.url_helpers)
|
|
@@ -29,7 +31,7 @@ module Shipit
|
|
|
29
31
|
:github,
|
|
30
32
|
Shipit.github_oauth_id,
|
|
31
33
|
Shipit.github_oauth_secret,
|
|
32
|
-
scope: 'email',
|
|
34
|
+
scope: 'email,repo_deployment',
|
|
33
35
|
client_options: Shipit.github_oauth_options,
|
|
34
36
|
)
|
|
35
37
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Shipit
|
|
2
|
+
class EnvironmentVariables
|
|
3
|
+
NotPermitted = Class.new(StandardError)
|
|
4
|
+
|
|
5
|
+
class << self
|
|
6
|
+
def with(env)
|
|
7
|
+
EnvironmentVariables.new(env)
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def permit(variable_definitions)
|
|
12
|
+
return {} unless @env
|
|
13
|
+
raise "A whitelist is required to sanitize environment variables" unless variable_definitions
|
|
14
|
+
sanitize_env_vars(variable_definitions)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def initialize(env)
|
|
20
|
+
@env = env
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def sanitize_env_vars(variable_definitions)
|
|
24
|
+
allowed_variables = variable_definitions.map(&:name)
|
|
25
|
+
|
|
26
|
+
allowed, disallowed = @env.partition { |k, _| allowed_variables.include?(k) }.map(&:to_h)
|
|
27
|
+
|
|
28
|
+
error_message = "Variables #{disallowed.keys.to_sentence} have not been whitelisted"
|
|
29
|
+
raise NotPermitted.new(error_message) unless disallowed.empty?
|
|
30
|
+
|
|
31
|
+
allowed
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
data/lib/shipit/task_commands.rb
CHANGED
|
@@ -31,6 +31,7 @@ module Shipit
|
|
|
31
31
|
normalized_name = ActiveSupport::Inflector.transliterate(@task.author.name)
|
|
32
32
|
super.merge(
|
|
33
33
|
'ENVIRONMENT' => @stack.environment,
|
|
34
|
+
'BRANCH' => @stack.branch,
|
|
34
35
|
'USER' => "#{@task.author.login} (#{normalized_name}) via Shipit",
|
|
35
36
|
'EMAIL' => @task.author.email,
|
|
36
37
|
'BUNDLE_PATH' => Rails.root.join('data', 'bundler').to_s,
|
data/lib/shipit/version.rb
CHANGED
|
@@ -18,6 +18,21 @@ module Shipit
|
|
|
18
18
|
assert_json 'status', 'pending'
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
test "#create triggers a new deploy for whitelisted variables" do
|
|
22
|
+
correct_env = {'SAFETY_DISABLED' => 1}
|
|
23
|
+
post :create, stack_id: @stack.to_param, sha: @commit.sha, env: correct_env
|
|
24
|
+
assert_response :accepted
|
|
25
|
+
assert_json 'type', 'deploy'
|
|
26
|
+
assert_json 'status', 'pending'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
test "#create refuses to trigger a new deploy with incorrect variables" do
|
|
30
|
+
incorrect_env = {'DANGEROUS_VARIABLE' => 1}
|
|
31
|
+
post :create, stack_id: @stack.to_param, sha: @commit.sha, env: incorrect_env
|
|
32
|
+
assert_response :unprocessable_entity
|
|
33
|
+
assert_json 'message', 'Variables DANGEROUS_VARIABLE have not been whitelisted'
|
|
34
|
+
end
|
|
35
|
+
|
|
21
36
|
test "#create use the claimed user as author" do
|
|
22
37
|
request.headers['X-Shipit-User'] = @user.login
|
|
23
38
|
post :create, stack_id: @stack.to_param, sha: @commit.sha
|
|
@@ -31,6 +31,21 @@ module Shipit
|
|
|
31
31
|
assert_json 'status', 'pending'
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
test "#trigger refuses to trigger a task with tasks not whitelisted" do
|
|
35
|
+
env = {'DANGEROUS_VARIABLE' => 'bar'}
|
|
36
|
+
post :trigger, stack_id: @stack.to_param, task_name: 'restart', env: env
|
|
37
|
+
assert_response :unprocessable_entity
|
|
38
|
+
assert_json 'message', 'Variables DANGEROUS_VARIABLE have not been whitelisted'
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
test "#trigger triggers a task with only whitelisted env variables" do
|
|
42
|
+
env = {'FOO' => 'bar'}
|
|
43
|
+
post :trigger, stack_id: @stack.to_param, task_name: 'restart', env: env
|
|
44
|
+
assert_response :accepted
|
|
45
|
+
assert_json 'type', 'task'
|
|
46
|
+
assert_json 'status', 'pending'
|
|
47
|
+
end
|
|
48
|
+
|
|
34
49
|
test "#trigger returns a 404 when the task doesn't exist" do
|
|
35
50
|
post :trigger, stack_id: @stack.to_param, task_name: 'doesnt_exist'
|
|
36
51
|
assert_response :not_found
|
|
@@ -3,12 +3,30 @@ require 'test_helper'
|
|
|
3
3
|
module Shipit
|
|
4
4
|
class GithubAuthenticationControllerTest < ActionController::TestCase
|
|
5
5
|
test ":callback can sign in to github" do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
auth = OmniAuth::AuthHash.new(
|
|
7
|
+
credentials: OmniAuth::AuthHash.new(
|
|
8
|
+
token: 's3cr3t',
|
|
9
|
+
),
|
|
10
|
+
extra: OmniAuth::AuthHash.new(
|
|
11
|
+
raw_info: OmniAuth::AuthHash.new(
|
|
12
|
+
id: 44,
|
|
13
|
+
name: 'Shipit',
|
|
14
|
+
email: 'shipit@example.com',
|
|
15
|
+
login: 'shipit',
|
|
16
|
+
avatar_url: 'https://example.com',
|
|
17
|
+
api_url: 'https://github.com/api/v3/users/shipit',
|
|
18
|
+
),
|
|
19
|
+
),
|
|
20
|
+
)
|
|
21
|
+
@request.env['omniauth.auth'] = auth
|
|
10
22
|
|
|
11
|
-
|
|
23
|
+
assert_difference -> { User.count } do
|
|
24
|
+
get :callback
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
user = User.find_by_login('shipit')
|
|
28
|
+
assert_equal 's3cr3t', user.github_access_token
|
|
29
|
+
assert_equal 44, user.github_id
|
|
12
30
|
end
|
|
13
31
|
end
|
|
14
32
|
end
|
|
@@ -15,13 +15,38 @@ module Shipit
|
|
|
15
15
|
assert_response :ok
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
test "tasks defined in the shipit.yml can be triggered" do
|
|
19
|
-
|
|
18
|
+
test "tasks defined in the shipit.yml can't be triggered if the stack is being deployed" do
|
|
19
|
+
assert @stack.active_task?
|
|
20
|
+
assert_no_difference -> { @stack.tasks.count } do
|
|
21
|
+
post :create, stack_id: @stack, definition_id: @definition.id
|
|
22
|
+
end
|
|
23
|
+
assert_redirected_to new_stack_tasks_path(@stack, @definition)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
test "tasks defined in the shipit.yml can be triggered anyway if force apram is present" do
|
|
27
|
+
assert @stack.active_task?
|
|
28
|
+
assert_difference -> { @stack.tasks.count } do
|
|
29
|
+
post :create, stack_id: @stack, definition_id: @definition.id, force: 'true'
|
|
30
|
+
end
|
|
31
|
+
assert_redirected_to stack_task_path(@stack, Task.last)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
test "tasks defined in the shipit.yml can be triggered while the stack is being deployed if specified as such" do
|
|
35
|
+
@definition = @stack.find_task_definition('flush_cache')
|
|
36
|
+
assert_difference -> { @stack.tasks.count } do
|
|
20
37
|
post :create, stack_id: @stack, definition_id: @definition.id
|
|
21
38
|
end
|
|
22
39
|
assert_redirected_to stack_task_path(@stack, Task.last)
|
|
23
40
|
end
|
|
24
41
|
|
|
42
|
+
test "tasks with variables defined in the shipit.yml can be triggered with their variables set" do
|
|
43
|
+
env = {"FOO" => "0"}
|
|
44
|
+
|
|
45
|
+
post :create, stack_id: @stack, definition_id: @definition.id, task: {env: env}, force: 'true'
|
|
46
|
+
|
|
47
|
+
assert_redirected_to stack_tasks_path(@stack, Task.last)
|
|
48
|
+
end
|
|
49
|
+
|
|
25
50
|
test "triggered tasks can be observed" do
|
|
26
51
|
get :show, stack_id: @stack, id: @task.id
|
|
27
52
|
assert_response :ok
|
|
@@ -171,8 +171,14 @@ module Shipit
|
|
|
171
171
|
end
|
|
172
172
|
|
|
173
173
|
def george
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
stub(
|
|
175
|
+
id: 42,
|
|
176
|
+
name: 'George Abitbol',
|
|
177
|
+
login: 'george',
|
|
178
|
+
email: 'george@cyclim.se',
|
|
179
|
+
avatar_url: 'https://avatars.githubusercontent.com/u/42?v=3',
|
|
180
|
+
url: 'https://api.github.com/user/george',
|
|
181
|
+
)
|
|
176
182
|
end
|
|
177
183
|
end
|
|
178
184
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
development:
|
|
2
|
-
secret_key_base:
|
|
2
|
+
secret_key_base: s3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3t
|
|
3
3
|
github_oauth:
|
|
4
4
|
# id:
|
|
5
5
|
# secret:
|
|
@@ -15,7 +15,7 @@ development:
|
|
|
15
15
|
redis_url: "redis://127.0.0.1:6379/7"
|
|
16
16
|
|
|
17
17
|
test:
|
|
18
|
-
secret_key_base:
|
|
18
|
+
secret_key_base: s3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3t
|
|
19
19
|
host: shipit.com
|
|
20
20
|
github_api:
|
|
21
21
|
access_token: t0kEn
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
development:
|
|
2
|
-
secret_key_base:
|
|
2
|
+
secret_key_base: s3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3t
|
|
3
3
|
# github_domain: github.shopify.com
|
|
4
4
|
github_oauth:
|
|
5
5
|
id: 29f6c9084a8837f337ff
|
|
@@ -14,7 +14,7 @@ development:
|
|
|
14
14
|
redis_url: "redis://127.0.0.1:6379/7"
|
|
15
15
|
|
|
16
16
|
test:
|
|
17
|
-
secret_key_base:
|
|
17
|
+
secret_key_base: s3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3t
|
|
18
18
|
host: shipit.com
|
|
19
19
|
github_api:
|
|
20
20
|
access_token: t0kEn
|