Skip to content

Commit 5bb04ca

Browse files
authored
Merge pull request #146 from jhodgkinson-splunk/fix-github-actions
FIX: update GitHub actions as they were failing
2 parents dcf2076 + eaa31e2 commit 5bb04ca

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

.github/workflows/build-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Checkout
2121
uses: actions/checkout@v4
2222
- name: Install Node.js
23-
uses: actions/setup-node@v3
23+
uses: actions/setup-node@v4
2424
with:
2525
node-version: 18
2626
- run: npm install
@@ -39,7 +39,7 @@ jobs:
3939
- name: Checkout
4040
uses: actions/checkout@v4
4141
- name: Install Node.js
42-
uses: actions/setup-node@v3
42+
uses: actions/setup-node@v4
4343
with:
4444
node-version: 18
4545
- run: npm install

.github/workflows/package-acceptance-test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@v4
1717
- name: Install Node.js
18-
uses: actions/setup-node@v3
18+
uses: actions/setup-node@v4
1919
with:
2020
node-version: 18
2121
- run: npm --version
@@ -25,7 +25,7 @@ jobs:
2525
- run: npm run package
2626
- run: npm install -g @vscode/vsce
2727
- run: vsce package
28-
- uses: actions/upload-artifact@v3
28+
- uses: actions/upload-artifact@v4
2929
with:
3030
name: vsix-package
3131
path: splunk-*.vsix
@@ -43,7 +43,7 @@ jobs:
4343
- name: Checkout
4444
uses: actions/checkout@v4
4545
- name: Download package
46-
uses: actions/download-artifact@v3
46+
uses: actions/download-artifact@v4
4747
with:
4848
name: vsix-package
4949
- run: pwd
@@ -52,7 +52,7 @@ jobs:
5252
- run: dir *.vsix
5353
if: runner.os == 'Windows'
5454
- name: Install Node.js
55-
uses: actions/setup-node@v3
55+
uses: actions/setup-node@v4
5656
with:
5757
node-version: 18
5858
- run: npm --version

out/notebooks/spl2/installer.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from 'axios';
22
import * as child_process from 'child_process';
3-
import { XMLParser} from 'fast-xml-parser';
3+
import { XMLParser } from 'fast-xml-parser';
44
import * as extract from 'extract-zip';
55
import * as fs from 'fs';
66
import * as path from 'path';
@@ -98,7 +98,7 @@ export async function installMissingSpl2Requirements(globalStoragePath: string,
9898
reject(`Error creating local artifact storage for SPL2, err: ${err}`);
9999
return Promise.resolve();
100100
}
101-
101+
102102
let installedLatestLsp = false;
103103
if (!lspVersion) {
104104
// If we haven't set up a Language Server version prompt use to accept terms
@@ -115,7 +115,7 @@ export async function installMissingSpl2Requirements(globalStoragePath: string,
115115
const localLspDir = getLocalLspDir(globalStoragePath);
116116
fs.rmSync(localLspDir, { recursive: true, force: true });
117117
makeLocalStorage(globalStoragePath); // recreate directory
118-
118+
119119
await getLatestSpl2Release(globalStoragePath, progressBar);
120120
installedLatestLsp = true;
121121
} catch (err) {
@@ -162,7 +162,7 @@ export async function installMissingSpl2Requirements(globalStoragePath: string,
162162
function isJavaVersionCompatible(javaLoc: string): boolean {
163163
let output;
164164
try {
165-
const javaVerCmd = child_process.spawnSync(javaLoc, ['-version'], { encoding : 'utf8' });
165+
const javaVerCmd = child_process.spawnSync(javaLoc, ['-version'], { encoding: 'utf8' });
166166
if (!javaVerCmd || javaVerCmd.stdout) {
167167
return false;
168168
}
@@ -223,16 +223,16 @@ async function promptToDownloadJava(): Promise<boolean> {
223223
);
224224
const downloadAndInstallChoice = 'Download and Install';
225225
const turnOffSPL2Choice = 'Turn off SPL2 support';
226-
226+
227227
const popup = window.showInformationMessage(
228228
promptMessage,
229229
{ modal: true },
230230
downloadAndInstallChoice,
231231
turnOffSPL2Choice,
232232
);
233-
233+
234234
const userSelection = (await popup) || null;
235-
switch(userSelection) {
235+
switch (userSelection) {
236236
case downloadAndInstallChoice:
237237
return Promise.resolve(true);
238238
case turnOffSPL2Choice:
@@ -255,7 +255,7 @@ async function installJDK(installDir: string, progressBar: StatusBarItem): Promi
255255
let os = '';
256256
let ext = 'tar.gz';
257257
// Determine architecture
258-
switch(process.arch) {
258+
switch (process.arch) {
259259
case 'x64':
260260
arch = process.arch;
261261
break;
@@ -270,7 +270,7 @@ async function installJDK(installDir: string, progressBar: StatusBarItem): Promi
270270
);
271271
}
272272
// Determine OS/extension
273-
switch(process.platform) {
273+
switch (process.platform) {
274274
case 'darwin':
275275
os = 'macos';
276276
break;
@@ -281,10 +281,10 @@ async function installJDK(installDir: string, progressBar: StatusBarItem): Promi
281281
default:
282282
os = 'linux';
283283
}
284-
284+
285285
const filename = `amazon-corretto-${minimumMajorJavaVersion}-${arch}-${os}-jdk.${ext}`;
286286
const url = `https://corretto.aws/downloads/latest/${filename}`;
287-
287+
288288
// Download to installDir
289289
const downloadedArchive = path.join(installDir, filename);
290290
let compressedSize = 0;
@@ -351,9 +351,7 @@ async function downloadWithProgress(
351351
const fileWriter = fs.createWriteStream(destinationPath);
352352

353353
return new Promise(async (resolve, reject) => {
354-
const { data, headers } = await axios({
355-
url,
356-
method: 'GET',
354+
const { data, headers } = await axios.get(url, {
357355
responseType: 'stream',
358356
transformRequest: (data, headers) => {
359357
// Override defaults set elsewhere for splunkd communication
@@ -364,7 +362,7 @@ async function downloadWithProgress(
364362
delete headers?.get['Authorization'];
365363
delete headers?.get['Accept'];
366364
return data;
367-
},
365+
},
368366
});
369367
const totalSize = parseInt(headers['content-length']);
370368
let totalDownloaded = 0;
@@ -395,7 +393,7 @@ async function downloadWithProgress(
395393
}
396394

397395
async function extractZipWithProgress(
398-
zipfilePath:string,
396+
zipfilePath: string,
399397
extractPath: string,
400398
compressedSize: number,
401399
progressBar: StatusBarItem,
@@ -407,17 +405,19 @@ async function extractZipWithProgress(
407405
// infer this from the read/unzip stream
408406
let binJavaPath = '';
409407
progressBar.text = `${progressBarText}...`;
410-
await extract(zipfilePath, { dir: extractPath, onEntry: (entry, zipfile) => {
411-
if (entry.fileName.endsWith('bin/java.exe') || entry.fileName.endsWith('bin\\java.exe')) {
412-
binJavaPath = path.join(extractPath, entry.fileName);
413-
}
414-
readCompressedSize += entry.compressedSize;
415-
let pct = Math.floor(readCompressedSize * 100 / compressedSize);
416-
if (pct >= nextUpdate) {
417-
progressBar.text = `${progressBarText} ${pct}%`;
418-
nextUpdate = pct + 1;
408+
await extract(zipfilePath, {
409+
dir: extractPath, onEntry: (entry, zipfile) => {
410+
if (entry.fileName.endsWith('bin/java.exe') || entry.fileName.endsWith('bin\\java.exe')) {
411+
binJavaPath = path.join(extractPath, entry.fileName);
412+
}
413+
readCompressedSize += entry.compressedSize;
414+
let pct = Math.floor(readCompressedSize * 100 / compressedSize);
415+
if (pct >= nextUpdate) {
416+
progressBar.text = `${progressBarText} ${pct}%`;
417+
nextUpdate = pct + 1;
418+
}
419419
}
420-
}});
420+
});
421421
if (!binJavaPath) {
422422
const jdkDir = fs.readdirSync(extractPath).filter(fn => fn.startsWith('jdk')); // e.g. jdk17.0.7_7
423423
if (jdkDir.length === 1) {
@@ -431,19 +431,19 @@ async function extractZipWithProgress(
431431
}
432432

433433
async function extractTgzWithProgress(
434-
tgzPath:string,
435-
extractPath: string,
436-
compressedSize: number,
437-
progressBar: StatusBarItem,
438-
progressBarText: string,
439-
): Promise<string> {
434+
tgzPath: string,
435+
extractPath: string,
436+
compressedSize: number,
437+
progressBar: StatusBarItem,
438+
progressBarText: string,
439+
): Promise<string> {
440440
// Create read and unzip streams and listen for individual entry to find bin\java.exe
441441
let binJavaPath;
442442
let readCompressedSize = 0;
443443
let nextUpdate = 1;
444444

445445
const pipe = util.promisify(pipeline);
446-
446+
447447
await pipe(
448448
fs.createReadStream(tgzPath).on('data', (chunk) => {
449449
readCompressedSize += chunk.length;
@@ -493,9 +493,9 @@ async function promptToDownloadLsp(alsoInstallJava: boolean): Promise<boolean> {
493493
viewTermsChoice,
494494
turnOffSPL2Choice,
495495
);
496-
496+
497497
const userSelection = (await popup) || null;
498-
switch(userSelection) {
498+
switch (userSelection) {
499499
case agreeAndContinueChoice:
500500
// Record preference so user is not asked again
501501
await workspace.getConfiguration().update(configKeyAcceptedTerms, TermsAcceptanceStatus.Accepted, true);

0 commit comments

Comments
 (0)