foreman_remote_execution 4.5.1 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby_ci.yml +7 -0
  3. data/app/controllers/ui_job_wizard_controller.rb +7 -0
  4. data/app/graphql/types/job_invocation.rb +16 -0
  5. data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +5 -1
  6. data/app/helpers/remote_execution_helper.rb +9 -3
  7. data/app/lib/actions/remote_execution/run_hosts_job.rb +1 -1
  8. data/app/models/job_invocation_composer.rb +3 -3
  9. data/app/models/job_template.rb +1 -1
  10. data/app/models/remote_execution_feature.rb +5 -1
  11. data/app/models/remote_execution_provider.rb +1 -1
  12. data/app/views/templates/ssh/module_action.erb +1 -0
  13. data/app/views/templates/ssh/power_action.erb +2 -0
  14. data/app/views/templates/ssh/puppet_run_once.erb +1 -0
  15. data/foreman_remote_execution.gemspec +2 -4
  16. data/lib/foreman_remote_execution/engine.rb +3 -0
  17. data/lib/foreman_remote_execution/version.rb +1 -1
  18. data/test/graphql/queries/job_invocation_query_test.rb +31 -0
  19. data/test/graphql/queries/job_invocations_query_test.rb +35 -0
  20. data/test/unit/concerns/host_extensions_test.rb +4 -4
  21. data/test/unit/input_template_renderer_test.rb +1 -89
  22. data/test/unit/job_invocation_composer_test.rb +1 -12
  23. data/webpack/JobWizard/JobWizard.js +28 -8
  24. data/webpack/JobWizard/JobWizard.scss +39 -0
  25. data/webpack/JobWizard/JobWizardConstants.js +10 -0
  26. data/webpack/JobWizard/JobWizardSelectors.js +9 -0
  27. data/webpack/JobWizard/__tests__/fixtures.js +104 -2
  28. data/webpack/JobWizard/__tests__/integration.test.js +13 -85
  29. data/webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js +21 -4
  30. data/webpack/JobWizard/steps/AdvancedFields/DescriptionField.js +67 -0
  31. data/webpack/JobWizard/steps/AdvancedFields/Fields.js +73 -59
  32. data/webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js +135 -16
  33. data/webpack/JobWizard/steps/AdvancedFields/__tests__/DescriptionField.test.js +23 -0
  34. data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js +122 -51
  35. data/webpack/JobWizard/steps/Schedule/QueryType.js +48 -0
  36. data/webpack/JobWizard/steps/Schedule/RepeatOn.js +61 -0
  37. data/webpack/JobWizard/steps/Schedule/ScheduleType.js +25 -0
  38. data/webpack/JobWizard/steps/Schedule/StartEndDates.js +51 -0
  39. data/webpack/JobWizard/steps/Schedule/__tests__/StartEndDates.test.js +22 -0
  40. data/webpack/JobWizard/steps/Schedule/index.js +41 -0
  41. data/webpack/JobWizard/steps/form/FormHelpers.js +1 -0
  42. data/webpack/JobWizard/steps/form/Formatter.js +149 -0
  43. data/webpack/JobWizard/steps/form/NumberInput.js +33 -0
  44. data/webpack/JobWizard/steps/form/SelectField.js +14 -2
  45. data/webpack/JobWizard/steps/form/__tests__/Formatter.test.js.example +76 -0
  46. data/webpack/__mocks__/foremanReact/components/SearchBar.js +18 -1
  47. data/webpack/react_app/components/RecentJobsCard/JobStatusIcon.js +43 -0
  48. data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +72 -66
  49. data/webpack/react_app/components/RecentJobsCard/RecentJobsTable.js +98 -0
  50. data/webpack/react_app/components/RecentJobsCard/constants.js +11 -0
  51. data/webpack/react_app/components/RecentJobsCard/styles.scss +11 -0
  52. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +1 -0
  53. data/webpack/react_app/extend/fillRecentJobsCard.js +1 -1
  54. metadata +23 -27
  55. data/webpack/JobWizard/__tests__/JobWizard.test.js +0 -13
  56. data/webpack/JobWizard/__tests__/__snapshots__/JobWizard.test.js.snap +0 -32
  57. data/webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap +0 -249
  58. data/webpack/JobWizard/steps/CategoryAndTemplate/__snapshots__/CategoryAndTemplate.test.js.snap +0 -113
  59. data/webpack/JobWizard/steps/form/__tests__/GroupedSelectField.test.js +0 -38
  60. data/webpack/JobWizard/steps/form/__tests__/SelectField.test.js +0 -23
  61. data/webpack/JobWizard/steps/form/__tests__/__snapshots__/GroupedSelectField.test.js.snap +0 -37
  62. data/webpack/JobWizard/steps/form/__tests__/__snapshots__/SelectField.test.js.snap +0 -23
  63. data/webpack/react_app/components/RecentJobsCard/styles.css +0 -15
@@ -0,0 +1,11 @@
1
+ .job-success {
2
+ color: var(--pf-global--success-color--100);
3
+ }
4
+
5
+ .job-error {
6
+ color: var(--pf-global--danger-color--100);
7
+ }
8
+
9
+ .job-info {
10
+ color: var(--pf-global--info-color--200);
11
+ }
@@ -27,6 +27,7 @@ exports[`TargetingHostsPage renders 1`] = `
27
27
  "controller": "hosts",
28
28
  }
29
29
  }
30
+ onChange={[Function]}
30
31
  onSearch={[Function]}
31
32
  />
32
33
  </Col>
@@ -6,6 +6,6 @@ export default () =>
6
6
  addGlobalFill(
7
7
  'details-cards',
8
8
  'rex-host-details-latest-jobs',
9
- <RecentJobsCard />,
9
+ <RecentJobsCard key="rex-host-details-latest-jobs" />,
10
10
  1000
11
11
  );
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_remote_execution
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.1
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Remote Execution team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-13 00:00:00.000000000 Z
11
+ date: 2021-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -44,34 +44,20 @@ dependencies:
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: 2.0.0
47
- - !ruby/object:Gem::Dependency
48
- name: foreman_remote_execution_core
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '0'
61
47
  - !ruby/object:Gem::Dependency
62
48
  name: foreman-tasks
63
49
  requirement: !ruby/object:Gem::Requirement
64
50
  requirements:
65
51
  - - ">="
66
52
  - !ruby/object:Gem::Version
67
- version: 4.1.0
53
+ version: 5.0.0
68
54
  type: :runtime
69
55
  prerelease: false
70
56
  version_requirements: !ruby/object:Gem::Requirement
71
57
  requirements:
72
58
  - - ">="
73
59
  - !ruby/object:Gem::Version
74
- version: 4.1.0
60
+ version: 5.0.0
75
61
  - !ruby/object:Gem::Dependency
76
62
  name: factory_bot_rails
77
63
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +136,7 @@ files:
150
136
  - app/controllers/remote_execution_features_controller.rb
151
137
  - app/controllers/template_invocations_controller.rb
152
138
  - app/controllers/ui_job_wizard_controller.rb
139
+ - app/graphql/types/job_invocation.rb
153
140
  - app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb
154
141
  - app/helpers/concerns/foreman_remote_execution/job_templates_extensions.rb
155
142
  - app/helpers/job_invocation_output_helper.rb
@@ -380,6 +367,8 @@ files:
380
367
  - test/functional/job_invocations_controller_test.rb
381
368
  - test/functional/job_templates_controller_test.rb
382
369
  - test/functional/ui_job_wizard_controller_test.rb
370
+ - test/graphql/queries/job_invocation_query_test.rb
371
+ - test/graphql/queries/job_invocations_query_test.rb
383
372
  - test/helpers/remote_execution_helper_test.rb
384
373
  - test/support/remote_execution_helper.rb
385
374
  - test/test_plugin_helper.rb
@@ -404,27 +393,30 @@ files:
404
393
  - webpack/JobWizard/JobWizard.scss
405
394
  - webpack/JobWizard/JobWizardConstants.js
406
395
  - webpack/JobWizard/JobWizardSelectors.js
407
- - webpack/JobWizard/__tests__/JobWizard.test.js
408
- - webpack/JobWizard/__tests__/__snapshots__/JobWizard.test.js.snap
409
396
  - webpack/JobWizard/__tests__/__snapshots__/integration.test.js.snap
410
397
  - webpack/JobWizard/__tests__/fixtures.js
411
398
  - webpack/JobWizard/__tests__/integration.test.js
412
399
  - webpack/JobWizard/index.js
413
400
  - webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js
401
+ - webpack/JobWizard/steps/AdvancedFields/DescriptionField.js
414
402
  - webpack/JobWizard/steps/AdvancedFields/Fields.js
415
403
  - webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js
416
- - webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap
404
+ - webpack/JobWizard/steps/AdvancedFields/__tests__/DescriptionField.test.js
417
405
  - webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js
418
406
  - webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js
419
- - webpack/JobWizard/steps/CategoryAndTemplate/__snapshots__/CategoryAndTemplate.test.js.snap
420
407
  - webpack/JobWizard/steps/CategoryAndTemplate/index.js
408
+ - webpack/JobWizard/steps/Schedule/QueryType.js
409
+ - webpack/JobWizard/steps/Schedule/RepeatOn.js
410
+ - webpack/JobWizard/steps/Schedule/ScheduleType.js
411
+ - webpack/JobWizard/steps/Schedule/StartEndDates.js
412
+ - webpack/JobWizard/steps/Schedule/__tests__/StartEndDates.test.js
413
+ - webpack/JobWizard/steps/Schedule/index.js
421
414
  - webpack/JobWizard/steps/form/FormHelpers.js
415
+ - webpack/JobWizard/steps/form/Formatter.js
422
416
  - webpack/JobWizard/steps/form/GroupedSelectField.js
417
+ - webpack/JobWizard/steps/form/NumberInput.js
423
418
  - webpack/JobWizard/steps/form/SelectField.js
424
- - webpack/JobWizard/steps/form/__tests__/GroupedSelectField.test.js
425
- - webpack/JobWizard/steps/form/__tests__/SelectField.test.js
426
- - webpack/JobWizard/steps/form/__tests__/__snapshots__/GroupedSelectField.test.js.snap
427
- - webpack/JobWizard/steps/form/__tests__/__snapshots__/SelectField.test.js.snap
419
+ - webpack/JobWizard/steps/form/__tests__/Formatter.test.js.example
428
420
  - webpack/Routes/routes.js
429
421
  - webpack/__mocks__/foremanReact/common/I18n.js
430
422
  - webpack/__mocks__/foremanReact/common/helpers.js
@@ -439,10 +431,12 @@ files:
439
431
  - webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js
440
432
  - webpack/global_index.js
441
433
  - webpack/index.js
434
+ - webpack/react_app/components/RecentJobsCard/JobStatusIcon.js
442
435
  - webpack/react_app/components/RecentJobsCard/RecentJobsCard.js
436
+ - webpack/react_app/components/RecentJobsCard/RecentJobsTable.js
443
437
  - webpack/react_app/components/RecentJobsCard/constants.js
444
438
  - webpack/react_app/components/RecentJobsCard/index.js
445
- - webpack/react_app/components/RecentJobsCard/styles.css
439
+ - webpack/react_app/components/RecentJobsCard/styles.scss
446
440
  - webpack/react_app/components/RegistrationExtension/RexInterface.js
447
441
  - webpack/react_app/components/RegistrationExtension/__tests__/RexInterface.test.js
448
442
  - webpack/react_app/components/RegistrationExtension/__tests__/__snapshots__/RexInterface.test.js.snap
@@ -517,6 +511,8 @@ test_files:
517
511
  - test/functional/job_invocations_controller_test.rb
518
512
  - test/functional/job_templates_controller_test.rb
519
513
  - test/functional/ui_job_wizard_controller_test.rb
514
+ - test/graphql/queries/job_invocation_query_test.rb
515
+ - test/graphql/queries/job_invocations_query_test.rb
520
516
  - test/helpers/remote_execution_helper_test.rb
521
517
  - test/support/remote_execution_helper.rb
522
518
  - test/test_plugin_helper.rb
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import * as patternfly from '@patternfly/react-core';
3
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
4
- import JobWizardPage from '../index';
5
-
6
- jest.spyOn(patternfly, 'Wizard');
7
- patternfly.Wizard.mockImplementation(props => <div>{props.navAriaLabel}</div>);
8
-
9
- const fixtures = {
10
- 'renders ': {},
11
- };
12
- describe('JobWizardPage rendering', () =>
13
- testComponentSnapshotsWithFixtures(JobWizardPage, fixtures));
@@ -1,32 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`JobWizardPage rendering renders 1`] = `
4
- <PageLayout
5
- breadcrumbOptions={
6
- Object {
7
- "breadcrumbItems": Array [
8
- Object {
9
- "caption": "Jobs",
10
- "url": "/jobs",
11
- },
12
- Object {
13
- "caption": "Run job",
14
- },
15
- ],
16
- }
17
- }
18
- header="Run job"
19
- searchable={false}
20
- >
21
- <Title
22
- headingLevel="h2"
23
- size="2xl"
24
- >
25
- Run job
26
- </Title>
27
- <Divider
28
- component="div"
29
- />
30
- <JobWizard />
31
- </PageLayout>
32
- `;
@@ -1,249 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`AdvancedFields rendring 1`] = `
4
- <Provider
5
- store={
6
- Object {
7
- "clearActions": [Function],
8
- "dispatch": [Function],
9
- "getActions": [Function],
10
- "getState": [Function],
11
- "replaceReducer": [Function],
12
- "subscribe": [Function],
13
- }
14
- }
15
- >
16
- <AdvancedFields
17
- advancedValues={Object {}}
18
- setAdvancedValues={[MockFunction]}
19
- >
20
- <Title
21
- className="advanced-fields-title"
22
- headingLevel="h2"
23
- >
24
- <h2
25
- className="pf-c-title pf-m-xl advanced-fields-title"
26
- >
27
- Advanced Fields
28
- </h2>
29
- </Title>
30
- <Form>
31
- <form
32
- className="pf-c-form"
33
- noValidate={true}
34
- >
35
- <EffectiveUserField
36
- setValue={[Function]}
37
- value=""
38
- >
39
- <mockConstructor
40
- fieldId="effective-user"
41
- label="Effective user"
42
- labelIcon={
43
- <Popover
44
- aria-label="help-text"
45
- bodyContent="A user to be used for executing the script. If it differs from the SSH user, su or sudo is used to switch the accounts."
46
- id="effective-user-help"
47
- >
48
- <button
49
- aria-label="open-help-tooltip-button"
50
- className="pf-c-form__group-label-help"
51
- onClick={[Function]}
52
- >
53
- <HelpIcon
54
- color="currentColor"
55
- noVerticalAlign={true}
56
- size="sm"
57
- />
58
- </button>
59
- </Popover>
60
- }
61
- >
62
- <div />
63
- </mockConstructor>
64
- </EffectiveUserField>
65
- <TimeoutToKillField
66
- setValue={[Function]}
67
- value=""
68
- >
69
- <mockConstructor
70
- fieldId="timeout-to-kill"
71
- label="Timeout to kill"
72
- labelIcon={
73
- <Popover
74
- aria-label="help-text"
75
- bodyContent="Time in seconds from the start on the remote host after which the job should be killed."
76
- id="timeout-to-kill-help"
77
- >
78
- <button
79
- aria-label="open-help-tooltip-button"
80
- className="pf-c-form__group-label-help"
81
- onClick={[Function]}
82
- >
83
- <HelpIcon
84
- color="currentColor"
85
- noVerticalAlign={true}
86
- size="sm"
87
- />
88
- </button>
89
- </Popover>
90
- }
91
- >
92
- <div />
93
- </mockConstructor>
94
- </TimeoutToKillField>
95
- <PasswordField
96
- setValue={[Function]}
97
- value=""
98
- >
99
- <mockConstructor
100
- fieldId="password"
101
- label="Password"
102
- labelIcon={
103
- <Popover
104
- aria-label="help-text"
105
- bodyContent="Password is stored encrypted in DB until the job finishes. For future or recurring executions, it is removed after the last execution."
106
- id="password-help"
107
- >
108
- <button
109
- aria-label="open-help-tooltip-button"
110
- className="pf-c-form__group-label-help"
111
- onClick={[Function]}
112
- >
113
- <HelpIcon
114
- color="currentColor"
115
- noVerticalAlign={true}
116
- size="sm"
117
- />
118
- </button>
119
- </Popover>
120
- }
121
- >
122
- <div />
123
- </mockConstructor>
124
- </PasswordField>
125
- <KeyPassphraseField
126
- setValue={[Function]}
127
- value=""
128
- >
129
- <mockConstructor
130
- fieldId="key-passphrase"
131
- label="Private key passphrase"
132
- labelIcon={
133
- <Popover
134
- aria-label="help-text"
135
- bodyContent="Key passphrase is only applicable for SSH provider. Other providers ignore this field. Passphrase is stored encrypted in DB until the job finishes. For future or recurring executions, it is removed after the last execution."
136
- id="key-passphrase-help"
137
- >
138
- <button
139
- aria-label="open-help-tooltip-button"
140
- className="pf-c-form__group-label-help"
141
- onClick={[Function]}
142
- >
143
- <HelpIcon
144
- color="currentColor"
145
- noVerticalAlign={true}
146
- size="sm"
147
- />
148
- </button>
149
- </Popover>
150
- }
151
- >
152
- <div />
153
- </mockConstructor>
154
- </KeyPassphraseField>
155
- <EffectiveUserPasswordField
156
- setValue={[Function]}
157
- value=""
158
- >
159
- <mockConstructor
160
- fieldId="effective-user-password"
161
- label="Effective user password"
162
- labelIcon={
163
- <Popover
164
- aria-label="help-text"
165
- bodyContent="Effective user password is only applicable for SSH provider. Other providers ignore this field. Password is stored encrypted in DB until the job finishes. For future or recurring executions, it is removed after the last execution."
166
- id="effective-user-password-help"
167
- >
168
- <button
169
- aria-label="open-help-tooltip-button"
170
- className="pf-c-form__group-label-help"
171
- onClick={[Function]}
172
- >
173
- <HelpIcon
174
- color="currentColor"
175
- noVerticalAlign={true}
176
- size="sm"
177
- />
178
- </button>
179
- </Popover>
180
- }
181
- >
182
- <div />
183
- </mockConstructor>
184
- </EffectiveUserPasswordField>
185
- <ConcurrencyLevelField
186
- setValue={[Function]}
187
- value=""
188
- >
189
- <mockConstructor
190
- fieldId="concurrency-level"
191
- label="Concurrency level"
192
- labelIcon={
193
- <Popover
194
- aria-label="help-text"
195
- bodyContent="Run at most N tasks at a time. If this is set and proxy batch triggering is enabled, then tasks are triggered on the smart proxy in batches of size 1."
196
- id="concurrency-level-help"
197
- >
198
- <button
199
- aria-label="open-help-tooltip-button"
200
- className="pf-c-form__group-label-help"
201
- onClick={[Function]}
202
- >
203
- <HelpIcon
204
- color="currentColor"
205
- noVerticalAlign={true}
206
- size="sm"
207
- />
208
- </button>
209
- </Popover>
210
- }
211
- >
212
- <div />
213
- </mockConstructor>
214
- </ConcurrencyLevelField>
215
- <TimeSpanLevelField
216
- setValue={[Function]}
217
- value=""
218
- >
219
- <mockConstructor
220
- fieldId="time-span"
221
- label="Time span"
222
- labelIcon={
223
- <Popover
224
- aria-label="help-text"
225
- bodyContent="Distribute execution over N seconds. If this is set and proxy batch triggering is enabled, then tasks are triggered on the smart proxy in batches of size 1."
226
- id="time-span-help"
227
- >
228
- <button
229
- aria-label="open-help-tooltip-button"
230
- className="pf-c-form__group-label-help"
231
- onClick={[Function]}
232
- >
233
- <HelpIcon
234
- color="currentColor"
235
- noVerticalAlign={true}
236
- size="sm"
237
- />
238
- </button>
239
- </Popover>
240
- }
241
- >
242
- <div />
243
- </mockConstructor>
244
- </TimeSpanLevelField>
245
- </form>
246
- </Form>
247
- </AdvancedFields>
248
- </Provider>
249
- `;