mirror of
https://github.com/Azure/setup-helm.git
synced 2025-11-07 13:06:56 +00:00
Added trigger for L2 tests and ran build.
This commit is contained in:
parent
e77e49c8f8
commit
4057e7396e
4 changed files with 75 additions and 23 deletions
32
.github/workflows/TriggerIntegrationTests.sh
vendored
Normal file
32
.github/workflows/TriggerIntegrationTests.sh
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
token=$1
|
||||||
|
commit=$2
|
||||||
|
repository=$3
|
||||||
|
prNumber=$4
|
||||||
|
frombranch=$5
|
||||||
|
tobranch=$6
|
||||||
|
|
||||||
|
getPayLoad() {
|
||||||
|
cat <<EOF
|
||||||
|
{
|
||||||
|
"event_type": "SetupHelmActionPR",
|
||||||
|
"client_payload":
|
||||||
|
{
|
||||||
|
"action": "SetupHelm",
|
||||||
|
"commit": "$commit",
|
||||||
|
"repository": "$repository",
|
||||||
|
"prNumber": "$prNumber",
|
||||||
|
"tobranch": "$tobranch",
|
||||||
|
"frombranch": "$frombranch"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
response=$(curl -X POST -H "Authorization: token $token" https://api.github.com/repos/sundargs2000/azure-actions-integration-tests/dispatches --data "$(getPayLoad)")
|
||||||
|
|
||||||
|
if [ "$response" == "" ]; then
|
||||||
|
echo "Integration tests triggered successfully"
|
||||||
|
else
|
||||||
|
echo "Triggering integration tests failed with: '$response'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
19
.github/workflows/integration-tests.yml
vendored
Normal file
19
.github/workflows/integration-tests.yml
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
name: "Trigger Integration tests"
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- 'releases/*'
|
||||||
|
jobs:
|
||||||
|
trigger-integration-tests:
|
||||||
|
name: Trigger Integration tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: IntegrationTests
|
||||||
|
|
||||||
|
- name: Trigger Test run
|
||||||
|
run: |
|
||||||
|
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 }}
|
||||||
|
|
@ -14,7 +14,9 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- run: |
|
|
||||||
|
- name: Build and run L0 tests.
|
||||||
|
run: |
|
||||||
npm install
|
npm install
|
||||||
npm build
|
npm run build
|
||||||
npm test
|
npm test
|
||||||
41
lib/run.js
41
lib/run.js
|
|
@ -10,21 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = __importStar(require("os"));
|
const os = require("os");
|
||||||
const path = __importStar(require("path"));
|
const path = require("path");
|
||||||
const util = __importStar(require("util"));
|
const util = require("util");
|
||||||
const fs = __importStar(require("fs"));
|
const fs = require("fs");
|
||||||
const semver = __importStar(require("semver"));
|
const semver = require("semver");
|
||||||
const toolCache = __importStar(require("@actions/tool-cache"));
|
const toolCache = require("@actions/tool-cache");
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = require("@actions/core");
|
||||||
const helmToolName = 'helm';
|
const helmToolName = 'helm';
|
||||||
const stableHelmVersion = 'v3.2.1';
|
const stableHelmVersion = 'v3.2.1';
|
||||||
const helmAllReleasesUrl = 'https://api.github.com/repos/helm/helm/releases';
|
const helmAllReleasesUrl = 'https://api.github.com/repos/helm/helm/releases';
|
||||||
|
|
@ -34,6 +27,7 @@ function getExecutableExtension() {
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
exports.getExecutableExtension = getExecutableExtension;
|
||||||
function getHelmDownloadURL(version) {
|
function getHelmDownloadURL(version) {
|
||||||
switch (os.type()) {
|
switch (os.type()) {
|
||||||
case 'Linux':
|
case 'Linux':
|
||||||
|
|
@ -45,6 +39,7 @@ function getHelmDownloadURL(version) {
|
||||||
return util.format('https://get.helm.sh/helm-%s-windows-amd64.zip', version);
|
return util.format('https://get.helm.sh/helm-%s-windows-amd64.zip', version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
exports.getHelmDownloadURL = getHelmDownloadURL;
|
||||||
function getStableHelmVersion() {
|
function getStableHelmVersion() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
|
|
@ -71,12 +66,13 @@ function getStableHelmVersion() {
|
||||||
return stableHelmVersion;
|
return stableHelmVersion;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var walkSync = function (dir, filelist, fileToFind) {
|
exports.getStableHelmVersion = getStableHelmVersion;
|
||||||
|
exports.walkSync = function (dir, filelist, fileToFind) {
|
||||||
var files = fs.readdirSync(dir);
|
var files = fs.readdirSync(dir);
|
||||||
filelist = filelist || [];
|
filelist = filelist || [];
|
||||||
files.forEach(function (file) {
|
files.forEach(function (file) {
|
||||||
if (fs.statSync(path.join(dir, file)).isDirectory()) {
|
if (fs.statSync(path.join(dir, file)).isDirectory()) {
|
||||||
filelist = walkSync(path.join(dir, file), filelist, fileToFind);
|
filelist = exports.walkSync(path.join(dir, file), filelist, fileToFind);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.debug(file);
|
core.debug(file);
|
||||||
|
|
@ -99,7 +95,7 @@ function downloadHelm(version) {
|
||||||
helmDownloadPath = yield toolCache.downloadTool(getHelmDownloadURL(version));
|
helmDownloadPath = yield toolCache.downloadTool(getHelmDownloadURL(version));
|
||||||
}
|
}
|
||||||
catch (exception) {
|
catch (exception) {
|
||||||
throw new Error(util.format("Failed to download Helm from location ", getHelmDownloadURL(version)));
|
throw new Error(util.format("Failed to download Helm from location", getHelmDownloadURL(version)));
|
||||||
}
|
}
|
||||||
fs.chmodSync(helmDownloadPath, '777');
|
fs.chmodSync(helmDownloadPath, '777');
|
||||||
const unzipedHelmPath = yield toolCache.extractZip(helmDownloadPath);
|
const unzipedHelmPath = yield toolCache.extractZip(helmDownloadPath);
|
||||||
|
|
@ -107,23 +103,25 @@ function downloadHelm(version) {
|
||||||
}
|
}
|
||||||
const helmpath = findHelm(cachedToolpath);
|
const helmpath = findHelm(cachedToolpath);
|
||||||
if (!helmpath) {
|
if (!helmpath) {
|
||||||
throw new Error(util.format("Helm executable not found in path ", cachedToolpath));
|
throw new Error(util.format("Helm executable not found in path", cachedToolpath));
|
||||||
}
|
}
|
||||||
fs.chmodSync(helmpath, '777');
|
fs.chmodSync(helmpath, '777');
|
||||||
return helmpath;
|
return helmpath;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
exports.downloadHelm = downloadHelm;
|
||||||
function findHelm(rootFolder) {
|
function findHelm(rootFolder) {
|
||||||
fs.chmodSync(rootFolder, '777');
|
fs.chmodSync(rootFolder, '777');
|
||||||
var filelist = [];
|
var filelist = [];
|
||||||
walkSync(rootFolder, filelist, helmToolName + getExecutableExtension());
|
exports.walkSync(rootFolder, filelist, helmToolName + getExecutableExtension());
|
||||||
if (!filelist) {
|
if (!filelist || filelist.length == 0) {
|
||||||
throw new Error(util.format("Helm executable not found in path ", rootFolder));
|
throw new Error(util.format("Helm executable not found in path", rootFolder));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return filelist[0];
|
return filelist[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
exports.findHelm = findHelm;
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let version = core.getInput('version', { 'required': true });
|
let version = core.getInput('version', { 'required': true });
|
||||||
|
|
@ -146,4 +144,5 @@ function run() {
|
||||||
core.setOutput('helm-path', cachedPath);
|
core.setOutput('helm-path', cachedPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
exports.run = run;
|
||||||
run().catch(core.setFailed);
|
run().catch(core.setFailed);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue