Skip to content

Commit

Permalink
fix up
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Yuan <[email protected]>
  • Loading branch information
SamYuan1990 committed Oct 6, 2024
1 parent b773b52 commit 596f65e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ You can now consume the action by referencing the main branch
prometheus_enable: true
tekton_enable: true
grafana_enable: true

- name: error handle
if: ${{ failure() }}
run: |
ls /tmp
ls /tmp/kubeconfig
```
| parameters | value | comments |
Expand Down
6 changes: 5 additions & 1 deletion 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.

6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const core = require('@actions/core');
const shell = require('shelljs');
const fs = require('fs');

function getInputOrDefault(inputName, defaultValue) {
const input = core.getInput(inputName);
Expand Down Expand Up @@ -94,7 +95,10 @@ async function setupcluster() {
let command = parameterExport +` && cd local-dev-cluster && bash -xc './main.sh up'`;
core.info('command going to be executed: ' + command);
executeCommand(command, "fail to setup local-dev-cluster")
executeCommand(`if [ -e /tmp/kubeconfig ]; then mv /tmp/kubeconfig /tmp/kubeconfig_bak fi`, "find exists files, use local-dev-cluster file instead.")
if (fs.existsSync(path.join(__dirname, '/tmp/kubeconfig'))) {
core.info('find exists kubeconfig, overwrite by local-dev-cluster setting');
executeCommand(`mv /tmp/kubeconfig /tmp/kubeconfig_bak`)
}
executeCommand(`mkdir -p /tmp/kubeconfig && cp ./local-dev-cluster/.kube/config /tmp/kubeconfig/`)
}

Expand Down

0 comments on commit 596f65e

Please sign in to comment.