Skip to content

Commit

Permalink
bump version for local-dev-cluster to 0.0.3
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Yuan <[email protected]>
  • Loading branch information
SamYuan1990 committed Aug 4, 2023
1 parent d7e47ee commit e603eda
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 112 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
- uses: actions/checkout@v3
- uses: ./
with:
runningBranch: ${{matrix.cluster_provider}}
local_dev_cluster_version: v0.0.1
cluster_provider: ${{matrix.cluster_provider}}
- name: verify
Expand All @@ -54,12 +53,9 @@ jobs:
- uses: actions/checkout@v3
- uses: ./
with:
runningBranch: ${{matrix.cluster_provider}}
cluster_provider: ${{matrix.cluster_provider}}
bcc_version: 0.25.0
kubectl_version: 1.27.2
local_dev_cluster_version: v0.0.1
kind_version: 0.20.0
local_dev_cluster_version: v0.0.3
prometheus_enable: true
prometheus_operator_version: v0.12.0
grafana_enable: true
Expand Down
66 changes: 13 additions & 53 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

66 changes: 13 additions & 53 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,77 +30,37 @@ async function bcc() {
return
}

async function kubectl() {
let kubectl_version = core.getInput('kubectl_version');
core.debug(kubectl_version);
if (kubectl_version === undefined || kubectl_version == null || kubectl_version.length === 0) {
kubectl_version="1.25.4";
}
core.info(`Get kubectl with version `+ kubectl_version);
if (shell.exec("curl -LO https://dl.k8s.io/release/v"+kubectl_version+"/bin/linux/amd64/kubectl").code !== 0) {
shell.echo("fail to install kubectl");
shell.exit(1);
}
}

async function setup() {
let cluster_provider = core.getInput('cluster_provider');
core.debug(cluster_provider);
if (cluster_provider == undefined || cluster_provider == null || cluster_provider.length ===0){
cluster_provider="kind";
}
async function setup(cluster_provider) {
let local_dev_cluster_version = core.getInput('local_dev_cluster_version');
core.debug(local_dev_cluster_version);
if (local_dev_cluster_version === undefined || local_dev_cluster_version == null || local_dev_cluster_version.length === 0) {
local_dev_cluster_version="main";
}
core.info(`Get local-cluster-dev with version `+ local_dev_cluster_version);
shell.exec("git clone -b "+local_dev_cluster_version+" https://github.com/sustainable-computing-io/local-dev-cluster.git --depth=1");
let parameterExport = "";
if (cluster_provider === "kind"){
const kind_version = core.getInput('kind_version');
core.debug(kind_version);
if (kind_version !== undefined && kind_version!=null && kind_version.length!=0) {
core.info(`use kind version `+kind_version);
// kind_version, KIND_VERSION
parameterExport = parameterExport + "export KIND_VERSION="+kind_version;
parameterExport = parameterExport + " && "
}
}
parameterExport = parameterExport + "export CLUSTER_PROVIDER="+cluster_provider;
let parameterExport = "export CLUSTER_PROVIDER="+cluster_provider;
const prometheus_enable = core.getInput('prometheus_enable');
core.debug(prometheus_enable);
if (prometheus_enable !== undefined && prometheus_enable!=null && prometheus_enable.length!=0) {
core.info(`use prometheus enable `+prometheus_enable);
// prometheus_enable, PROMETHEUS_ENABLE
if (parameterExport != "") {
parameterExport = parameterExport + " && "
}
parameterExport = parameterExport + "export PROMETHEUS_ENABLE="+prometheus_enable;
parameterExport = parameterExport + " && export PROMETHEUS_ENABLE="+prometheus_enable;
}
const prometheus_operator_version = core.getInput('prometheus_operator_version');
core.debug(prometheus_operator_version);
if (prometheus_operator_version !== undefined && prometheus_operator_version!=null && prometheus_operator_version.length!=0) {
core.info(`use prometheus operator version `+prometheus_operator_version);
// prometheus_operator_version, PROMETHEUS_OPERATOR_VERSION
if (parameterExport != "") {
parameterExport = parameterExport + " && "
}
parameterExport = parameterExport + "export PROMETHEUS_OPERATOR_VERSION="+prometheus_operator_version;
parameterExport = parameterExport + " && export PROMETHEUS_OPERATOR_VERSION="+prometheus_operator_version;
}
const grafana_enable = core.getInput('grafana_enable');
core.debug(grafana_enable);
if (grafana_enable !== undefined && grafana_enable!=null && grafana_enable.length!=0) {
core.info(`use grafana enable `+grafana_enable);
// grafana_enable, GRAFANA_ENABLE
if (parameterExport != "") {
parameterExport = parameterExport + " && "
}
parameterExport = parameterExport + "export GRAFANA_ENABLE="+grafana_enable;
}
if (parameterExport != "") {
parameterExport = parameterExport + " && "
parameterExport = parameterExport + " && export GRAFANA_ENABLE="+grafana_enable;
}
parameterExport = parameterExport + " && "
core.debug(parameterExport);
shell.exec(parameterExport +` cd local-dev-cluster && bash -c './main.sh up'`)
return
Expand All @@ -109,21 +69,21 @@ async function setup() {
// most @actions toolkit packages have async methods
async function run() {
const runningBranch = core.getInput('runningBranch');
let cluster_provider = core.getInput('cluster_provider');
core.debug(cluster_provider);
try {
if (runningBranch == 'bcc') {
return bcc()
}
if (runningBranch == 'kind') {
if (runningBranch == 'kind' || cluster_provider == 'kind') {
bcc()
kubectl()
return setup()
return setup(cluster_provider)
}
if (runningBranch == 'microshift') {
if (runningBranch == 'microshift' || cluster_provider == 'microshift') {
bcc()
kubectl()
return setup()
return setup(cluster_provider)
}
core.error('runningBranch should in value of [bcc, kind, microshift]')
core.error('runningBranch should in value of [bcc, kind, microshift], or use cluster_provider as [kind, microshift] for short')
} catch (error) {
core.setFailed(error.message);
}
Expand Down

0 comments on commit e603eda

Please sign in to comment.