Skip to content

Commit cc2c85b

Browse files
authored
support only v3 and switch away from github token
1 parent 7e3c8fd commit cc2c85b

File tree

6 files changed

+11799
-475
lines changed

6 files changed

+11799
-475
lines changed

Diff for: .github/workflows/TriggerIntegrationTests.sh

-33
This file was deleted.

Diff for: .github/workflows/integration-tests.yml

+51-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,58 @@ jobs:
88
trigger-integration-tests:
99
name: Trigger Integration tests
1010
runs-on: ubuntu-latest
11+
env:
12+
HELM_3_8_0: "v3.8.0"
13+
HELM_3_7_2: "v3.7.2"
14+
HELM_3_5_0: "v3.5.0"
15+
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
1116
steps:
1217
- name: Check out repository
1318
uses: actions/checkout@v2
14-
with:
15-
path: IntegrationTests
16-
17-
- name: Trigger Test run
19+
- name: npm install and build
20+
id: action-npm-build
1821
run: |
19-
bash ./IntegrationTests/.github/workflows/TriggerIntegrationTests.sh ${{ secrets.L2_REPO_TOKEN }} ${{ github.event.pull_request.head.sha }} ${{ github.repository }} ${{ github.event.pull_request.number }} ${{ github.event.pull_request.head.ref }} ${{ github.event.pull_request.base.ref }} ${{ secrets.L2_REPO_USER }}
22+
echo $PR_BASE_REF
23+
if [[ $PR_BASE_REF != releases/* ]]; then
24+
npm install
25+
npm run build
26+
fi
27+
- name: Setup helm
28+
uses: ./
29+
with:
30+
version: ${{ env.HELM_3_8_0 }}
31+
- name: Validate helm 3.8.0
32+
run: |
33+
if [[ $(helm version) != *$HELM_3_8_0* ]]; then
34+
echo "HELM VERSION INCORRECT: HELM VERSION DOES NOT CONTAIN v3.8.0"
35+
echo "HELM VERSION OUTPUT: $(helm version)"
36+
exit 1
37+
else
38+
echo "HELM VERSION $HELM_3_8_0 INSTALLED SUCCESSFULLY"
39+
fi
40+
- name: Setup helm 3.7.2
41+
uses: ./
42+
with:
43+
version: ${{ env.HELM_3_7_2 }}
44+
- name: Validate 3.7.2
45+
run: |
46+
if [[ $(helm version) != *$HELM_3_7_2* ]]; then
47+
echo "HELM VERSION INCORRECT: HELM VERSION DOES NOT CONTAIN v3.7.2"
48+
echo "HELM VERSION OUTPUT: $(helm version)"
49+
exit 1
50+
else
51+
echo "HELM VERSION $HELM_3_7_2 INSTALLED SUCCESSFULLY"
52+
fi
53+
- name: Setup helm 3.5.0
54+
uses: ./
55+
with:
56+
version: ${{ env.HELM_3_5_0 }}
57+
- name: Validate 3.5.0
58+
run: |
59+
if [[ $(helm version) != *$HELM_3_5_0* ]]; then
60+
echo "HELM VERSION INCORRECT: HELM VERSION DOES NOT CONTAIN v3.5.0"
61+
echo "HELM VERSION OUTPUT: $(helm version)"
62+
exit 1
63+
else
64+
echo "HELM VERSION $HELM_3_5_0 INSTALLED SUCCESSFULLY"
65+
fi

Diff for: __tests__/run.test.ts

+13-34
Original file line numberDiff line numberDiff line change
@@ -22,55 +22,34 @@ describe('run.ts', () => {
2222

2323
test('getHelmDownloadURL() - return the URL to download helm for Linux', () => {
2424
jest.spyOn(os, 'type').mockReturnValue('Linux');
25-
const kubectlLinuxUrl = 'https://get.helm.sh/helm-v3.2.1-linux-amd64.zip'
25+
const kubectlLinuxUrl = 'https://get.helm.sh/helm-v3.8.0-linux-amd64.zip'
2626

27-
expect(run.getHelmDownloadURL('v3.2.1')).toBe(kubectlLinuxUrl);
27+
expect(run.getHelmDownloadURL('v3.8.0')).toBe(kubectlLinuxUrl);
2828
expect(os.type).toBeCalled();
2929
});
3030

3131
test('getHelmDownloadURL() - return the URL to download helm for Darwin', () => {
3232
jest.spyOn(os, 'type').mockReturnValue('Darwin');
33-
const kubectlDarwinUrl = 'https://get.helm.sh/helm-v3.2.1-darwin-amd64.zip'
33+
const kubectlDarwinUrl = 'https://get.helm.sh/helm-v3.8.0-darwin-amd64.zip'
3434

35-
expect(run.getHelmDownloadURL('v3.2.1')).toBe(kubectlDarwinUrl);
35+
expect(run.getHelmDownloadURL('v3.8.0')).toBe(kubectlDarwinUrl);
3636
expect(os.type).toBeCalled();
3737
});
3838

3939
test('getHelmDownloadURL() - return the URL to download helm for Windows', () => {
4040
jest.spyOn(os, 'type').mockReturnValue('Windows_NT');
4141

42-
const kubectlWindowsUrl = 'https://get.helm.sh/helm-v3.2.1-windows-amd64.zip'
43-
expect(run.getHelmDownloadURL('v3.2.1')).toBe(kubectlWindowsUrl);
42+
const kubectlWindowsUrl = 'https://get.helm.sh/helm-v3.8.0-windows-amd64.zip'
43+
expect(run.getHelmDownloadURL('v3.8.0')).toBe(kubectlWindowsUrl);
4444
expect(os.type).toBeCalled();
4545
});
4646

47-
test('getStableHelmVersion() - download stable version file, read version and return it', async () => {
48-
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue('pathToTool');
49-
const response = JSON.stringify(
50-
[
51-
{
52-
'tag_name': 'v4.0.0'
53-
}, {
54-
'tag_name': 'v3.0.0'
55-
}, {
56-
'tag_name': 'v2.0.0'
57-
}
58-
]
59-
);
60-
jest.spyOn(fs, 'readFileSync').mockReturnValue(response);
61-
62-
expect(await run.getStableHelmVersion()).toBe('v4.0.0');
63-
expect(toolCache.downloadTool).toBeCalled();
64-
expect(fs.readFileSync).toBeCalledWith('pathToTool', 'utf8');
65-
});
66-
67-
test('getStableHelmVersion() - return default version if error occurs while getting latest version', async () => {
68-
jest.spyOn(toolCache, 'downloadTool').mockRejectedValue('Unable to download');
69-
jest.spyOn(core, 'warning').mockImplementation();
70-
71-
expect(await run.getStableHelmVersion()).toBe('v3.2.1');
72-
expect(toolCache.downloadTool).toBeCalled();
73-
expect(core.warning).toBeCalledWith("Cannot get the latest Helm info from https://api.github.com/repos/helm/helm/releases. Error Unable to download. Using default Helm version v3.2.1.");
47+
test('getLatestHelmVersion() - return the latest version of HELM', async () => {
48+
try{
49+
expect(await run.getLatestHelmVersion()).toBe("v3.8.0");
50+
} catch (e){
51+
return e;
52+
}
7453
});
7554

7655
test('walkSync() - return path to the all files matching fileToFind in dir', () => {
@@ -146,7 +125,7 @@ describe('run.ts', () => {
146125
return { isDirectory: () => isDirectory } as fs.Stats;
147126
});
148127

149-
expect(await run.downloadHelm(null)).toBe(path.join('pathToCachedDir', 'helm.exe'));
128+
expect(await run.downloadHelm("v4.0.0")).toBe(path.join('pathToCachedDir', 'helm.exe'));
150129
expect(toolCache.find).toBeCalledWith('helm', 'v4.0.0');
151130
expect(toolCache.downloadTool).toBeCalledWith('https://get.helm.sh/helm-v4.0.0-windows-amd64.zip');
152131
expect(fs.chmodSync).toBeCalledWith('pathToTool', '777');

0 commit comments

Comments
 (0)