@spinnaker/core 0.26.0 → 0.28.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.
@@ -2,11 +2,12 @@ export declare class OrchestratedItemTransformer {
2
2
  static addRunningTime(item: any): void;
3
3
  private static shouldReplace;
4
4
  static defineProperties(item: any): void;
5
- private static mergeExceptions;
6
- private static getOrchestrationException;
5
+ private static getFailureMessagesAsString;
6
+ private static getFailureMessages;
7
+ private static getOrchestrationExceptionMessage;
7
8
  private static getLockFailureException;
8
- private static getCustomException;
9
- private static getGeneralException;
9
+ private static getCustomExceptionMessage;
10
+ private static getGeneralExceptionMessages;
10
11
  private static calculateRunningTime;
11
12
  private static normalizeStatus;
12
13
  }
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@spinnaker/core",
3
3
  "license": "Apache-2.0",
4
- "version": "0.26.0",
4
+ "version": "0.28.0",
5
5
  "module": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
7
10
  "scripts": {
8
11
  "clean": "shx rm -rf dist",
9
12
  "prepublishOnly": "npm run build",
@@ -17,7 +20,7 @@
17
20
  "@apollo/client": "^3.6.9",
18
21
  "@fortawesome/fontawesome-free": "5.5.0",
19
22
  "@spinnaker/mocks": "1.0.7",
20
- "@spinnaker/presentation": "^0.3.0",
23
+ "@spinnaker/presentation": "^0.3.1",
21
24
  "@spinnaker/styleguide": "2.0.0",
22
25
  "@uirouter/angularjs": "1.0.26",
23
26
  "@uirouter/core": "6.0.8",
@@ -88,8 +91,8 @@
88
91
  "@graphql-codegen/typescript": "^1.22.4",
89
92
  "@graphql-codegen/typescript-operations": "^1.18.3",
90
93
  "@graphql-codegen/typescript-react-apollo": "^2.3.0",
91
- "@spinnaker/eslint-plugin": "^3.0.1",
92
- "@spinnaker/scripts": "^0.3.0",
94
+ "@spinnaker/eslint-plugin": "^3.0.2",
95
+ "@spinnaker/scripts": "^0.4.0",
93
96
  "@types/angular": "1.6.26",
94
97
  "@types/angular-mocks": "1.5.10",
95
98
  "@types/angular-ui-bootstrap": "0.13.41",
@@ -120,5 +123,5 @@
120
123
  "shx": "0.3.3",
121
124
  "typescript": "4.3.5"
122
125
  },
123
- "gitHead": "581f9d4358d0c90a385df0119a7ae0a41b81c1cb"
126
+ "gitHead": "20d6ca89f39a5f44a802a1ccaffd669587450d76"
124
127
  }
@@ -39,6 +39,7 @@ export interface IFeatures {
39
39
  mdGitIntegration?: boolean;
40
40
  managedServiceAccounts?: boolean;
41
41
  managedResources?: boolean;
42
+ multiBlockFailureMessages?: boolean;
42
43
  notifications?: boolean;
43
44
  pagerDuty?: boolean;
44
45
  pipelines?: boolean;
@@ -16,6 +16,7 @@ export interface IOrchestratedItem extends ITimedItem {
16
16
  getValueFor: (k: string) => any;
17
17
  originalStatus: string;
18
18
  status: string;
19
+ failureMessages: string[];
19
20
  failureMessage: string;
20
21
  isBuffered: boolean;
21
22
  isCompleted: boolean;
@@ -75,8 +75,11 @@ export class OrchestratedItemTransformer {
75
75
  item.originalStatus = item.status;
76
76
 
77
77
  Object.defineProperties(item, {
78
+ failureMessages: {
79
+ get: (): string[] => this.getFailureMessages(item),
80
+ },
78
81
  failureMessage: {
79
- get: (): string => this.mergeExceptions(item),
82
+ get: (): string => this.getFailureMessagesAsString(item),
80
83
  },
81
84
  isCompleted: {
82
85
  get: (): boolean => ['SUCCEEDED', 'SKIPPED'].includes(item.status),
@@ -131,19 +134,23 @@ export class OrchestratedItemTransformer {
131
134
  });
132
135
  }
133
136
 
134
- private static mergeExceptions(item: any): string | null {
135
- const exceptions = [
136
- this.getCustomException(item),
137
- this.getGeneralException(item),
138
- this.getOrchestrationException(item),
139
- ].filter((it) => !!it);
137
+ private static getFailureMessagesAsString(item: any): string | null {
138
+ const exceptions = this.getFailureMessages(item);
140
139
  if (exceptions.length === 0) {
141
140
  return null;
142
141
  }
143
142
  return exceptions.join('\n\n');
144
143
  }
145
144
 
146
- private static getOrchestrationException(task: ITask): string {
145
+ private static getFailureMessages(task: ITask): string[] {
146
+ return [
147
+ this.getCustomExceptionMessage(task),
148
+ ...this.getGeneralExceptionMessages(task),
149
+ this.getOrchestrationExceptionMessage(task),
150
+ ].filter((it) => !!it);
151
+ }
152
+
153
+ private static getOrchestrationExceptionMessage(task: ITask): string {
147
154
  const katoTasks: any[] = task.getValueFor('kato.tasks');
148
155
  if (katoTasks && katoTasks.length) {
149
156
  const failedTask: any = katoTasks.find((t) => t.status && t.status.failed);
@@ -190,7 +197,7 @@ export class OrchestratedItemTransformer {
190
197
  return null;
191
198
  }
192
199
 
193
- private static getCustomException(task: ITask): string {
200
+ private static getCustomExceptionMessage(task: ITask): string {
194
201
  const generalException: any = task.getValueFor('exception');
195
202
  if (generalException) {
196
203
  if (generalException.exceptionType && generalException.exceptionType === 'LockFailureException') {
@@ -200,16 +207,17 @@ export class OrchestratedItemTransformer {
200
207
  return null;
201
208
  }
202
209
 
203
- private static getGeneralException(task: ITask): string {
210
+ private static getGeneralExceptionMessages(task: ITask): string[] {
204
211
  const generalException: any = task.getValueFor('exception');
205
212
  if (generalException) {
206
213
  const errors = (generalException.details?.errors ?? []).filter((m: any) => !!m);
207
214
  if (errors.length) {
208
- return errors.join('\n\n');
215
+ return errors;
209
216
  }
210
- return generalException.details?.error ?? null;
217
+
218
+ return generalException.details?.error ? [generalException.details.error] : [];
211
219
  }
212
- return null;
220
+ return [];
213
221
  }
214
222
 
215
223
  private static calculateRunningTime(item: IOrchestratedItem): () => number {
@@ -10,6 +10,7 @@ import {
10
10
  StageArtifactSelectorDelegate,
11
11
  } from '../../../../../artifact';
12
12
  import { StageConfigField } from '../../common/stageConfigField/StageConfigField';
13
+ import { SETTINGS } from '../../../../../config';
13
14
  import type { IArtifact, IExpectedArtifact } from '../../../../../domain';
14
15
  import { MapEditor } from '../../../../../forms';
15
16
  import { CheckboxInput, TextInput } from '../../../../../presentation';
@@ -152,9 +153,30 @@ export class BakeHelmConfigForm extends React.Component<IFormikStageConfigInject
152
153
 
153
154
  public render() {
154
155
  const stage = this.props.formik.values;
156
+ const enableApiVersions = SETTINGS.feature.helmApiVersions;
155
157
  return (
156
158
  <>
157
159
  <h4>Helm Options</h4>
160
+ {enableApiVersions && ( // Only render if enableApiVersions is true
161
+ <>
162
+ <StageConfigField fieldColumns={3} label={'ApiVersions'}>
163
+ <TextInput
164
+ onChange={(e: React.ChangeEvent<any>) => {
165
+ this.props.formik.setFieldValue('apiVersions', e.target.value);
166
+ }}
167
+ value={stage.apiVersions}
168
+ />
169
+ </StageConfigField>
170
+ <StageConfigField fieldColumns={3} label={'KubeVersion'}>
171
+ <TextInput
172
+ onChange={(e: React.ChangeEvent<any>) => {
173
+ this.props.formik.setFieldValue('kubeVersion', e.target.value);
174
+ }}
175
+ value={stage.kubeVersion}
176
+ />
177
+ </StageConfigField>
178
+ </>
179
+ )}
158
180
  <StageConfigField fieldColumns={3} label={'Name'}>
159
181
  <TextInput
160
182
  onChange={(e: React.ChangeEvent<any>) => {
@@ -8,7 +8,6 @@ import * as reactDOM from 'react-dom';
8
8
  import * as rxjs from 'rxjs';
9
9
 
10
10
  import * as spinnakerCore from '../index';
11
-
12
11
  export const sharedLibraries = {
13
12
  // This is the global (window) variable that the shared libs will be exposed on
14
13
  globalVariablePrefix: 'spinnaker.plugins.sharedLibraries',
@@ -30,7 +29,9 @@ export const sharedLibraries = {
30
29
  if (destinationObject) {
31
30
  // Temporarily expose @spinnaker/core.
32
31
  // This should be removed at some point and replaced with a much smaller spinnaker/ui module which doesn't yet exist
32
+ exposeSharedLibrary('ajv', require('ajv'));
33
33
  exposeSharedLibrary('@spinnaker/core', spinnakerCore);
34
+ exposeSharedLibrary('@spinnaker/kayenta', require('@spinnaker/kayenta'));
34
35
  exposeSharedLibrary('@uirouter/core', uiRouterCore);
35
36
  exposeSharedLibrary('@uirouter/react', uiRouterReact);
36
37
  exposeSharedLibrary('@uirouter/rx', uiRouterRx);
@@ -38,6 +39,9 @@ export const sharedLibraries = {
38
39
  exposeSharedLibrary('prop-types', propTypes);
39
40
  exposeSharedLibrary('react', react);
40
41
  exposeSharedLibrary('react-dom', reactDOM);
42
+ exposeSharedLibrary('react-redux', require('react-redux'));
43
+ exposeSharedLibrary('redux-actions', require('redux-actions'));
44
+ exposeSharedLibrary('reselect', require('reselect'));
41
45
  exposeSharedLibrary('rxjs', rxjs);
42
46
  exposeSharedLibrary('rxjs/Observable', { Observable: rxjs.Observable });
43
47
  }
@@ -12,9 +12,11 @@ export const CollapsibleElement: React.FC<{ maxHeight: number }> = ({ children,
12
12
  setIsOverflowing(contentRef.current.offsetHeight < contentRef.current.scrollHeight);
13
13
  }, []);
14
14
 
15
- React.useEffect(() => {
16
- checkIsOverflowing();
17
- }, [children, checkIsOverflowing]);
15
+ React.useLayoutEffect(() => {
16
+ setTimeout(() => {
17
+ checkIsOverflowing();
18
+ });
19
+ }, [checkIsOverflowing]);
18
20
 
19
21
  React.useEffect(() => {
20
22
  window.addEventListener('resize', checkIsOverflowing);