Add IP to debug logs

This commit is contained in:
Sascha Mann
2020-08-18 23:00:08 +02:00
parent fc275221aa
commit b4e544c83e
5 changed files with 46 additions and 6 deletions

View File

@@ -11,7 +11,7 @@ This action sets up a Julia environment for use in actions by downloading a spec
- [Julia Versions](#julia-versions) - [Julia Versions](#julia-versions)
- [Matrix Testing](#matrix-testing) - [Matrix Testing](#matrix-testing)
- [Versioning](#versioning) - [Versioning](#versioning)
- [Privacy Info](#privacy-info) - [Debug logs](#debug-logs)
- [Third party information](#third-party-information) - [Third party information](#third-party-information)
## Usage ## Usage
@@ -150,6 +150,11 @@ steps:
- uses: julia-actions/setup-julia@v0.1.0 # specific version tag - uses: julia-actions/setup-julia@v0.1.0 # specific version tag
``` ```
## Debug logs
You can enable [Step Debug Logs](https://github.com/actions/toolkit/blob/main/docs/action-debugging.md#step-debug-logs) for more detailed logs.
Note that when debug logs are enabled, a request will be sent to `https://httpbin.julialang.org/ip` and the runner's IP will be printed to the debug logs.
## Third party information ## Third party information
Parts of this software have been derived from other open source software. Parts of this software have been derived from other open source software.
See [THIRD_PARTY_NOTICE.md](THIRD_PARTY_NOTICE.md) for details. See [THIRD_PARTY_NOTICE.md](THIRD_PARTY_NOTICE.md) for details.

16
lib/setup-julia.js generated
View File

@@ -18,11 +18,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
const exec = __importStar(require("@actions/exec")); const exec = __importStar(require("@actions/exec"));
const tc = __importStar(require("@actions/tool-cache")); const tc = __importStar(require("@actions/tool-cache"));
const https = __importStar(require("https"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const installer = __importStar(require("./installer")); const installer = __importStar(require("./installer"));
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
// Debugging info
if (core.isDebug()) {
// Log Runner IP Address
https.get('https://httpbin.julialang.org/ip', resp => {
let data = '';
resp.on('data', chunk => {
data += chunk;
});
resp.on('end', () => {
core.debug(`Runner IP address: ${JSON.parse(data).origin}`);
});
}).on('error', err => {
core.debug(`ERROR: Could not retrieve runner IP: ${err}`);
});
}
// Inputs // Inputs
const versionInput = core.getInput('version'); const versionInput = core.getInput('version');
const arch = core.getInput('arch'); const arch = core.getInput('arch');

8
package-lock.json generated
View File

@@ -1,13 +1,13 @@
{ {
"name": "setup-julia", "name": "setup-julia",
"version": "1.1.11", "version": "1.1.12",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@actions/core": { "@actions/core": {
"version": "1.0.0", "version": "1.2.4",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
"integrity": "sha512-aMIlkx96XH4E/2YZtEOeyrYQfhlas9jIRkfGPqMwXD095Rdkzo4lB6ZmbxPQSzD+e1M+Xsm98ZhuSMYGv/AlqA==" "integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg=="
}, },
"@actions/exec": { "@actions/exec": {
"version": "1.0.0", "version": "1.0.0",

View File

@@ -21,7 +21,7 @@
"author": "Sascha Mann <git@mail.saschamann.eu>", "author": "Sascha Mann <git@mail.saschamann.eu>",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.0.0", "@actions/core": "^1.2.4",
"@actions/exec": "^1.0.0", "@actions/exec": "^1.0.0",
"@actions/io": "^1.0.0", "@actions/io": "^1.0.0",
"@actions/tool-cache": "^1.0.0", "@actions/tool-cache": "^1.0.0",

View File

@@ -2,12 +2,31 @@ import * as core from '@actions/core'
import * as exec from '@actions/exec' import * as exec from '@actions/exec'
import * as tc from '@actions/tool-cache' import * as tc from '@actions/tool-cache'
import * as https from 'https'
import * as path from 'path' import * as path from 'path'
import * as installer from './installer' import * as installer from './installer'
async function run() { async function run() {
try { try {
// Debugging info
if (core.isDebug()) {
// Log Runner IP Address
https.get('https://httpbin.julialang.org/ip', resp => {
let data = ''
resp.on('data', chunk => {
data += chunk
})
resp.on('end', () => {
core.debug(`Runner IP address: ${JSON.parse(data).origin}`)
})
}).on('error', err => {
core.debug(`ERROR: Could not retrieve runner IP: ${err}`)
})
}
// Inputs // Inputs
const versionInput = core.getInput('version') const versionInput = core.getInput('version')
const arch = core.getInput('arch') const arch = core.getInput('arch')