shipit-engine 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/app/assets/images/caret-down.svg +1 -0
  4. data/app/assets/javascripts/shipit/stacks.js.coffee +10 -0
  5. data/app/assets/stylesheets/_base/_banner.scss +7 -3
  6. data/app/assets/stylesheets/_base/_base.scss +0 -74
  7. data/app/assets/stylesheets/_base/_buttons.scss +7 -3
  8. data/app/assets/stylesheets/_base/_colors.scss +2 -0
  9. data/app/assets/stylesheets/_base/_icons.scss +8 -0
  10. data/app/assets/stylesheets/_base/_spacing.scss +21 -0
  11. data/app/assets/stylesheets/_pages/_commits.scss +41 -3
  12. data/app/assets/stylesheets/_structure/_layout.scss +8 -35
  13. data/app/assets/stylesheets/_structure/_main.scss +2 -2
  14. data/app/assets/stylesheets/_structure/_navigation.scss +89 -0
  15. data/app/assets/stylesheets/shipit.scss +3 -0
  16. data/app/controllers/concerns/shipit/api/rendering.rb +3 -6
  17. data/app/controllers/shipit/api/ccmenu_controller.rb +4 -0
  18. data/app/controllers/shipit/commits_controller.rb +18 -0
  19. data/app/jobs/shipit/destroy_stack_job.rb +25 -0
  20. data/app/jobs/shipit/github_sync_job.rb +12 -1
  21. data/app/jobs/shipit/merge_pull_requests_job.rb +3 -0
  22. data/app/models/shipit/commit.rb +14 -2
  23. data/app/models/shipit/deploy.rb +5 -0
  24. data/app/models/shipit/deploy_spec.rb +9 -6
  25. data/app/models/shipit/deploy_spec/kubernetes_discovery.rb +24 -2
  26. data/app/models/shipit/pull_request.rb +16 -1
  27. data/app/models/shipit/stack.rb +11 -4
  28. data/app/models/shipit/task_definition.rb +4 -0
  29. data/app/models/shipit/team.rb +1 -1
  30. data/app/models/shipit/undeployed_commit.rb +1 -2
  31. data/app/models/shipit/user.rb +1 -1
  32. data/app/models/shipit/variable_definition.rb +5 -0
  33. data/app/serializers/shipit/stack_serializer.rb +1 -1
  34. data/app/views/layouts/shipit.html.erb +2 -1
  35. data/app/views/shipit/commits/_commit.html.erb +9 -1
  36. data/app/views/shipit/deploys/rollback.html.erb +1 -1
  37. data/app/views/shipit/stacks/_header.html.erb +15 -3
  38. data/app/views/shipit/stacks/settings.html.erb +1 -1
  39. data/config/locales/en.yml +9 -5
  40. data/config/routes.rb +1 -0
  41. data/db/migrate/20170310164315_add_merged_at_on_pull_requests.rb +9 -0
  42. data/db/migrate/20170314145604_add_last_deployed_at_to_stack.rb +9 -0
  43. data/db/migrate/20170320124156_add_locked_to_commits.rb +5 -0
  44. data/lib/shipit/task_commands.rb +1 -0
  45. data/lib/shipit/version.rb +1 -1
  46. data/test/controllers/api/ccmenu_controller_test.rb +6 -0
  47. data/test/controllers/api/stacks_controller_test.rb +6 -0
  48. data/test/controllers/api/tasks_controller_test.rb +31 -0
  49. data/test/controllers/commits_controller_test.rb +18 -0
  50. data/test/dummy/db/development.sqlite3 +0 -0
  51. data/test/dummy/db/schema.rb +4 -1
  52. data/test/dummy/db/test.sqlite3 +0 -0
  53. data/test/dummy/db/test.sqlite3-journal +0 -0
  54. data/test/fixtures/shipit/commits.yml +1 -1
  55. data/test/fixtures/shipit/pull_requests.yml +33 -0
  56. data/test/fixtures/shipit/stacks.yml +4 -1
  57. data/test/jobs/github_sync_job_test.rb +49 -0
  58. data/test/jobs/merge_pull_requests_job_test.rb +18 -0
  59. data/test/models/commits_test.rb +71 -0
  60. data/test/models/deploy_spec_test.rb +15 -0
  61. data/test/models/deploys_test.rb +7 -0
  62. data/test/models/pull_request_test.rb +19 -1
  63. data/test/models/task_definitions_test.rb +9 -0
  64. data/test/models/undeployed_commits_test.rb +2 -7
  65. data/test/unit/deploy_commands_test.rb +7 -0
  66. data/test/unit/variable_definition_test.rb +10 -0
  67. metadata +15 -7
  68. data/app/assets/images/github.svg +0 -9
  69. data/app/assets/images/refresh.svg +0 -8
  70. data/app/assets/images/settings.svg +0 -33
  71. data/lib/snippets/deploy-to-gke +0 -161
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 728cef09e4ae36c728e2a5d933f5967f4dcbe757
4
- data.tar.gz: e35599675982e893d70e0c25d678da7e8910e7f4
3
+ metadata.gz: 823b4ce78b43702c4ee8ceb34d1d34d9bfa354a9
4
+ data.tar.gz: 6a1e04142c22e9d4e30abf037e0f67bc739cc524
5
5
  SHA512:
6
- metadata.gz: bc3ecc88e8e13e99dca6f5789d364de99a21374fa566cd0273ed013f2f2b8da1c9a007fe9931daa76f66c12ba0ff9890cd2c8b4110d28f35510a7e3d29a3cef0
7
- data.tar.gz: fde31379bbe98eb1dfb6af272a54a1b6b9e1a3e171d1dcc1588f8e67a257fe633117d1c35251f3543d3a5d585039c68e0e21dcd2ce8f945f009deee0bd722695
6
+ metadata.gz: 3582bf6393aed76da430d4b5a8219c4954bb7b0079f21d30ad07379c690a695a27faa91a18ad133e85ad595490e066532e837e933108838d4f35e3aa3429fe17
7
+ data.tar.gz: af60bdde100570fce61e7ef0ae42bd1e9f7a2b1d38ddee79ef20cbd0d11c9a0f5fb33ec4bc12db1fa757c6856e13b08ac3a82547a694ef7dac903bb9cd7dbf9a
data/README.md CHANGED
@@ -634,6 +634,7 @@ Your deploy scripts have access to the following environment variables:
634
634
  * `BRANCH`: The stack branch (e.g `master`)
635
635
  * `LAST_DEPLOYED_SHA`: The git SHA of the last deployed commit
636
636
  * `DIFF_LINK`: URL to the diff on GitHub.
637
+ * `TASK_ID`: ID of the task that is running
637
638
  * All the content of the `secrets.yml` `env` key
638
639
  * All the content of the `shipit.yml` `machine.environment` key
639
640
 
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 8l5 5 5-5" fill="#248AF2" fill-rule="evenodd"/></svg>
@@ -1,3 +1,13 @@
1
+ $(document).on 'click', '.commit-lock a', (event) ->
2
+ event.preventDefault()
3
+ $commit = $(event.target).closest('.commit')
4
+ $link = $(event.target).closest('a')
5
+
6
+ locked = $commit.hasClass('locked')
7
+ $commit.toggleClass('locked')
8
+
9
+ $.ajax($link.attr('href'), method: 'PATCH', data: {commit: {locked: !locked}})
10
+
1
11
  jQuery ($) ->
2
12
  displayIgnoreCiMessage = ->
3
13
  ignoreCiMessage = $(".ignoring-ci")
@@ -6,10 +6,14 @@
6
6
  background: $blue;
7
7
  padding: 1.75rem 0;
8
8
  position: relative;
9
- }
10
9
 
11
- .banner a {
12
- color: #fff;
10
+ a {
11
+ color: #fff;
12
+ }
13
+
14
+ .icon {
15
+ background-color: #fff;
16
+ }
13
17
  }
14
18
 
15
19
  .banner__inner {
@@ -106,8 +106,6 @@ a {
106
106
  text-decoration: none;
107
107
  cursor: pointer;
108
108
  color: $blue;
109
- &.subdued { color: #999; }
110
- &.subdued:hover { color: $blue; }
111
109
  }
112
110
 
113
111
  .more {
@@ -145,79 +143,7 @@ h5 {
145
143
  margin: 0; margin-bottom: .5rem;
146
144
  }
147
145
 
148
- // Buttons
149
-
150
-
151
-
152
- .ico {
153
- display: inline-block;
154
- background-position: center center;
155
- background-repeat: no-repeat;
156
- text-indent: -99999px;
157
- }
158
-
159
- .ico-refresh-wrapper {
160
- display: inline-block;
161
- background-position: center center;
162
- background-repeat: no-repeat;
163
- }
164
-
165
- .ico-refresh {
166
- @extend .ico;
167
- background-image: asset-data-url('refresh.svg');
168
- background-size: 24px auto;
169
- width: 18px; height: 18px;
170
- border:none;
171
- background-color: transparent;
172
- }
173
-
174
- .ico-github {
175
- @extend .ico;
176
- background-image: asset-data-url('github.svg');
177
- background-size: 22px auto;
178
- width: 18px; height: 18px;
179
- }
180
-
181
- .ico-settings {
182
- @extend .ico;
183
- background-image: asset-data-url('settings.svg');
184
- width: 18px; height: 18px;
185
- }
186
-
187
- .ico-pending-small,
188
- .ico-success-small,
189
- .ico-error-small, .ico-failure-small {
190
- @extend .ico;
191
- width: 14px; height: 14px;
192
- margin-bottom: -2px;
193
- }
194
-
195
- .ico-success-small {
196
- background: asset-data-url("success.svg") center center no-repeat;
197
- background-size: contain;
198
- margin-right: 3px;
199
- }
200
-
201
- .ico-error-small, .ico-failure-small {
202
- background: asset-data-url("failure.svg") center center no-repeat;
203
- background-size: contain;
204
- }
205
-
206
- .ico-pending-small {
207
- background: asset-data-url("pending.gif") center center no-repeat;
208
- background-size: contain;
209
- margin-right: 3px;
210
- }
211
-
212
- .icon--lock {
213
- display: inline-block;
214
- background: asset-data-url("lock.svg") center center no-repeat;
215
- height: 15px;
216
- width: 12px;
217
- }
218
-
219
146
  [data-tooltip], [data-tooltip-multiline] { // Add this attribute to the element that needs a tooltip
220
-
221
147
  position: relative;
222
148
  cursor: pointer;
223
149
  -webkit-transform: translate3d(0,0,0);
@@ -19,16 +19,18 @@
19
19
  background-color: $blue;
20
20
  color: #fff;
21
21
  box-shadow: none;
22
+
22
23
  &.btn--disabled {
23
24
  box-shadow: 0 0 0 1px rgba(#000, 0.15);
24
25
  }
26
+
25
27
  &.btn--warning {
26
28
  background-color: $yellow;
27
29
  }
28
30
  }
29
31
 
30
32
  .btn--disabled {
31
- color: #999;
33
+ color: $grey;
32
34
  background-color: #fafafa;
33
35
  cursor: default;
34
36
  }
@@ -37,8 +39,9 @@
37
39
  color: #fff;
38
40
  border: none;
39
41
  background-color: $bright-red;
42
+
40
43
  &.btn-disabled {
41
- color: #999;
44
+ color: $grey;
42
45
  background-color: $light-red;
43
46
  }
44
47
  }
@@ -46,8 +49,9 @@
46
49
  .btn--alert {
47
50
  color: #fff;
48
51
  background-color: $orange;
52
+
49
53
  &.btn-disabled {
50
- color: #999;
54
+ color: $grey;
51
55
  background-color: $light-orange;
52
56
  }
53
57
  }
@@ -15,3 +15,5 @@ $orange: #FFAD4C;
15
15
  $light-orange: #ffebcc;
16
16
  $slate: #2E343A;
17
17
  $terminal-black: #272C30;
18
+ $grey: #999;
19
+ $grey-light: #e0e0e0;
@@ -0,0 +1,8 @@
1
+ .icon--lock {
2
+ display: inline-block;
3
+ background-color: #000;
4
+ mask: asset-data-url("lock.svg") no-repeat 50% 50%;
5
+ // background: asset-data-url("lock.svg") center center no-repeat;
6
+ height: 15px;
7
+ width: 12px;
8
+ }
@@ -0,0 +1,21 @@
1
+ $spacing-data: (
2
+ tight: 0.75rem,
3
+ base: 1rem,
4
+ loose: 1.5rem
5
+ );
6
+
7
+ /// Returns the spacing value for a given variant.
8
+ ///
9
+ /// @param {String} $variant - The key for the given variant.
10
+ /// @return {Number} The spacing for the variant.
11
+
12
+ @function spacing($variant: base) {
13
+ $fetched-value: map-get($spacing-data, $variant);
14
+
15
+ @if type-of($fetched-value) == number {
16
+ @return $fetched-value;
17
+ } @else {
18
+ @error 'Spacing variant `#{$variant}` not found. Available variants: #{available-names($spacing-data)}';
19
+ }
20
+ }
21
+
@@ -63,7 +63,7 @@
63
63
  }
64
64
 
65
65
  .commit-author__name__username {
66
- color: #999;
66
+ color: $grey;
67
67
  }
68
68
 
69
69
 
@@ -98,9 +98,42 @@
98
98
  color: $blue;
99
99
  }
100
100
 
101
+ .commit-lock {
102
+ display: inline-block;
103
+ .icon {
104
+ background-color: #ddd;
105
+ }
106
+
107
+ &:hover .icon {
108
+ background-color: darken(#ddd, 20%);
109
+ }
110
+
111
+ .action-unlock-commit {
112
+ display: none;
113
+ }
114
+ }
115
+
116
+ .commit.locked .commit-lock {
117
+ .icon {
118
+ background-color: $bright-red;
119
+ }
120
+
121
+ &:hover .icon {
122
+ background-color: darken($bright-red, 20%);
123
+ }
124
+
125
+ .action-lock-commit {
126
+ display: none;
127
+ }
128
+
129
+ .action-unlock-commit {
130
+ display: inline-block;
131
+ }
132
+ }
133
+
101
134
  .commit-meta, .pr-meta {
102
135
  font-size: 0.8em;
103
- color: #999;
136
+ color: $grey;
104
137
  margin: 0;
105
138
 
106
139
  @include media(desktop) {
@@ -133,6 +166,11 @@
133
166
 
134
167
  @include media(desktop) {
135
168
  margin-left: 1rem;
169
+ min-width: 10rem;
170
+
171
+ .btn {
172
+ float: right;
173
+ }
136
174
  }
137
175
  }
138
176
 
@@ -285,5 +323,5 @@
285
323
 
286
324
  .commit-summary__sha {
287
325
  font-size: 0.875rem;
288
- color: #999;
326
+ color: $grey;
289
327
  }
@@ -16,13 +16,13 @@
16
16
  .header {
17
17
  border-bottom: 1px solid #e5e5e5;
18
18
  background-color: #fff;
19
- color: #999;
19
+ color: $grey;
20
20
  }
21
21
 
22
22
  .header__inner {
23
23
  display: flex;
24
24
  flex-wrap: wrap;
25
- padding: 1.5em 0;
25
+ padding: spacing(loose) 0;
26
26
  position: relative;
27
27
  }
28
28
 
@@ -35,16 +35,16 @@
35
35
  }
36
36
 
37
37
  .header__btn {
38
- margin: .4em .5em .4em 0;
38
+ margin: 0.4em 0.5em 0.4em 0;
39
39
  }
40
40
 
41
41
  .powered-by {
42
42
  float: right;
43
43
  position: relative;
44
- top: .5rem;
45
- right: 1rem;
44
+ top: spacing(tight);
45
+ right: spacing();
46
46
  font-size: 12px;
47
- color: #999;
47
+ color: $grey;
48
48
  }
49
49
 
50
50
 
@@ -56,42 +56,15 @@
56
56
  display: block;
57
57
  width: 40px;
58
58
  height: 40px;
59
- transition: transform .3s ease-in-out;
59
+ transition: transform 0.3s ease-in-out;
60
60
  text-indent: -9999px;
61
61
  position: absolute;
62
62
  top: 50%;
63
63
  right: 100%;
64
- margin-right: 1em;
64
+ margin-right: spacing();
65
65
  margin-top: -20px;
66
66
 
67
67
  &:hover {
68
68
  transform: rotate(-25deg);
69
69
  }
70
70
  }
71
-
72
-
73
- // NAVIGATION
74
- // -----------------------------------------------------------------------------
75
-
76
- .nav {
77
- display: flex;
78
- margin-bottom: 1.5rem;
79
- }
80
-
81
- .nav__list {
82
- list-style-type: none;
83
- margin: 0;
84
- padding: 0;
85
- }
86
-
87
- .nav__list--primary {
88
- flex-grow: 1;
89
- }
90
-
91
- .nav__list__item {
92
- display: inline-block;
93
-
94
- & + & {
95
- margin-left: 1.5em;
96
- }
97
- }
@@ -40,7 +40,7 @@
40
40
  & > p {
41
41
  margin: 0;
42
42
  padding: .7rem 0;
43
- color: #999;
43
+ color: $grey;
44
44
  font-size: .875rem;
45
45
  .repo-name { font-weight: 500; color: #777; }
46
46
  }
@@ -140,7 +140,7 @@ pre {
140
140
  }
141
141
 
142
142
  .less-important {
143
- color: #999;
143
+ color: $grey;
144
144
  margin-bottom: 0em;
145
145
  margin-top: 1em;
146
146
  p {
@@ -0,0 +1,89 @@
1
+ // NAVIGATION
2
+ // -----------------------------------------------------------------------------
3
+
4
+ .nav {
5
+ display: flex;
6
+ }
7
+
8
+ .nav__list {
9
+ list-style-type: none;
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ .nav__list--primary {
15
+ flex-grow: 1;
16
+ }
17
+
18
+ .nav__list__item {
19
+ display: inline-block;
20
+ cursor: pointer;
21
+ color: $blue;
22
+ padding-bottom: spacing(loose);
23
+
24
+ + .nav__list__item {
25
+ margin-left: spacing(loose);
26
+ }
27
+ }
28
+
29
+ .nav__list__sub__item {
30
+ list-style: none;
31
+ white-space: nowrap;
32
+
33
+ + .nav__list__sub__item {
34
+ margin-top: spacing(tight);
35
+ }
36
+ }
37
+
38
+ $tool-tip-size: 12px;
39
+ $tool-tip-offset: $tool-tip-size / 2 + 1;
40
+ $sub-nav-offset: -10px;
41
+
42
+ .nav__sub__list {
43
+ position: absolute;
44
+ top: calc(100% - #{spacing(tight)});
45
+ z-index: 10;
46
+ background-color: white;
47
+ padding: spacing(tight);
48
+ opacity: 0;
49
+ pointer-events: none;
50
+ transform: translateY($sub-nav-offset);
51
+ border: 1px solid $grey-light;
52
+ border-radius: 3px;
53
+ transition:
54
+ opacity 0.2s ease-in-out,
55
+ transform 0.2s ease-in-out;
56
+
57
+ &::after {
58
+ content: '';
59
+ display: block;
60
+ position: absolute;
61
+ top: -1 * $tool-tip-offset;
62
+ background-color: white;
63
+ border: 1px solid $grey-light;
64
+ border-right-color: transparent;
65
+ border-bottom-color: transparent;
66
+ height: $tool-tip-size;
67
+ width: $tool-tip-size;
68
+ transform: rotate(45deg);
69
+ }
70
+ }
71
+
72
+ .nav__list__item--has-children {
73
+ position: relative;
74
+ display: inline-flex;
75
+
76
+ &::after {
77
+ display: inline-block;
78
+ content: '';
79
+ background-image: asset-data-url('caret-down.svg');
80
+ width: 20px;
81
+ height: 20px;
82
+ }
83
+
84
+ &:hover .nav__sub__list {
85
+ opacity: 1;
86
+ pointer-events: initial;
87
+ transform: translateY(0);
88
+ }
89
+ }