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
fd01bfbecb
4 changed files with 76 additions and 24 deletions
33
.github/workflows/TriggerIntegrationTests.sh
vendored
Normal file
33
.github/workflows/TriggerIntegrationTests.sh
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
token=$1
|
||||
commit=$2
|
||||
repository=$3
|
||||
prNumber=$4
|
||||
frombranch=$5
|
||||
tobranch=$6
|
||||
patUser=$7
|
||||
|
||||
getPayLoad() {
|
||||
cat <<EOF
|
||||
{
|
||||
"event_type": "SetupHelmActionPR",
|
||||
"client_payload":
|
||||
{
|
||||
"action": "SetupHelm",
|
||||
"commit": "$commit",
|
||||
"repository": "$repository",
|
||||
"prNumber": "$prNumber",
|
||||
"tobranch": "$tobranch",
|
||||
"frombranch": "$frombranch"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
response=$(curl -u $patUser:$token -X POST https://api.github.com/repos/Azure/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 }} ${{ secrets.L2_REPO_USER }}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
name: "build-test"
|
||||
name: "Run unit tests."
|
||||
on: # rebuild any PRs and main branch changes
|
||||
pull_request:
|
||||
branches:
|
||||
|
|
@ -14,7 +14,8 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- run: |
|
||||
|
||||
- name: Run L0 tests.
|
||||
run: |
|
||||
npm install
|
||||
npm build
|
||||
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());
|
||||
});
|
||||
};
|
||||
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 });
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const util = __importStar(require("util"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const semver = __importStar(require("semver"));
|
||||
const toolCache = __importStar(require("@actions/tool-cache"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const util = require("util");
|
||||
const fs = require("fs");
|
||||
const semver = require("semver");
|
||||
const toolCache = require("@actions/tool-cache");
|
||||
const core = require("@actions/core");
|
||||
const helmToolName = 'helm';
|
||||
const stableHelmVersion = 'v3.2.1';
|
||||
const helmAllReleasesUrl = 'https://api.github.com/repos/helm/helm/releases';
|
||||
|
|
@ -34,6 +27,7 @@ function getExecutableExtension() {
|
|||
}
|
||||
return '';
|
||||
}
|
||||
exports.getExecutableExtension = getExecutableExtension;
|
||||
function getHelmDownloadURL(version) {
|
||||
switch (os.type()) {
|
||||
case 'Linux':
|
||||
|
|
@ -45,6 +39,7 @@ function getHelmDownloadURL(version) {
|
|||
return util.format('https://get.helm.sh/helm-%s-windows-amd64.zip', version);
|
||||
}
|
||||
}
|
||||
exports.getHelmDownloadURL = getHelmDownloadURL;
|
||||
function getStableHelmVersion() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
|
|
@ -71,12 +66,13 @@ function getStableHelmVersion() {
|
|||
return stableHelmVersion;
|
||||
});
|
||||
}
|
||||
var walkSync = function (dir, filelist, fileToFind) {
|
||||
exports.getStableHelmVersion = getStableHelmVersion;
|
||||
exports.walkSync = function (dir, filelist, fileToFind) {
|
||||
var files = fs.readdirSync(dir);
|
||||
filelist = filelist || [];
|
||||
files.forEach(function (file) {
|
||||
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 {
|
||||
core.debug(file);
|
||||
|
|
@ -99,7 +95,7 @@ function downloadHelm(version) {
|
|||
helmDownloadPath = yield toolCache.downloadTool(getHelmDownloadURL(version));
|
||||
}
|
||||
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');
|
||||
const unzipedHelmPath = yield toolCache.extractZip(helmDownloadPath);
|
||||
|
|
@ -107,23 +103,25 @@ function downloadHelm(version) {
|
|||
}
|
||||
const helmpath = findHelm(cachedToolpath);
|
||||
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');
|
||||
return helmpath;
|
||||
});
|
||||
}
|
||||
exports.downloadHelm = downloadHelm;
|
||||
function findHelm(rootFolder) {
|
||||
fs.chmodSync(rootFolder, '777');
|
||||
var filelist = [];
|
||||
walkSync(rootFolder, filelist, helmToolName + getExecutableExtension());
|
||||
if (!filelist) {
|
||||
throw new Error(util.format("Helm executable not found in path ", rootFolder));
|
||||
exports.walkSync(rootFolder, filelist, helmToolName + getExecutableExtension());
|
||||
if (!filelist || filelist.length == 0) {
|
||||
throw new Error(util.format("Helm executable not found in path", rootFolder));
|
||||
}
|
||||
else {
|
||||
return filelist[0];
|
||||
}
|
||||
}
|
||||
exports.findHelm = findHelm;
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let version = core.getInput('version', { 'required': true });
|
||||
|
|
@ -146,4 +144,5 @@ function run() {
|
|||
core.setOutput('helm-path', cachedPath);
|
||||
});
|
||||
}
|
||||
exports.run = run;
|
||||
run().catch(core.setFailed);
|
||||
|
|
|
|||
Loading…
Reference in a new issue