Skip to content

Commit d641b47

Browse files
author
Hunter-Thompson
committed
feat: ignore diff for app spec
1 parent 647c6d9 commit d641b47

File tree

4 files changed

+101
-6
lines changed

4 files changed

+101
-6
lines changed

API.md

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,17 @@ export interface ArgoCdApplicationSpec {
5555
readonly source?: ApplicationSource;
5656
readonly destination?: ApplicationDestination;
5757
readonly syncPolicy?: ApplicationSyncPolicy;
58+
readonly ignoreDifferences?: ResourceIgnoreDifferences[];
59+
}
5860

61+
export interface ResourceIgnoreDifferences {
62+
readonly jsonPointers?: string[];
63+
readonly jqPathExpressions?: string[];
64+
readonly kind?: string;
65+
readonly name?: string;
66+
readonly namespace?: string;
67+
readonly group?: string;
68+
readonly server?: string;
5969
}
6070

6171
export interface ProjectRoles {
@@ -148,4 +158,4 @@ export class ArgoCdApplication extends ApiObject {
148158
public constructor(scope: Construct, id: string, props: ArgoCdApplicationProps) {
149159
super(scope, id, ArgoCdApplication.manifest(props));
150160
}
151-
}
161+
}

test/__snapshots__/hello.test.ts.snap

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/hello.test.ts

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
1-
test('basic', () => {
2-
const a = 2;
3-
// expect(a).toEqual(2) this will pass
4-
expect(a).toEqual(2);
5-
});
1+
import { Chart, Testing } from 'cdk8s';
2+
import * as argo from '../src/';
3+
4+
test('app', () => {
5+
const app = Testing.app();
6+
const chart = new Chart(app, 'test', {
7+
namespace: 'test',
8+
});
9+
10+
new argo.ArgoCdApplication(chart, 'test', {
11+
spec: {
12+
project: 'test',
13+
ignoreDifferences: [
14+
{
15+
kind: 'Deployment',
16+
jsonPointers: [
17+
'/spec/replicas',
18+
],
19+
group: 'apps',
20+
},
21+
22+
],
23+
source: {
24+
repoURL: 'test',
25+
targetRevision: 'test',
26+
path: 'test',
27+
directory: {
28+
recurse: true,
29+
},
30+
},
31+
},
32+
});
33+
34+
expect(Testing.synth(chart)).toMatchSnapshot();
35+
});

0 commit comments

Comments
 (0)