Skip to content

Commit

Permalink
Add back support for service account activation
Browse files Browse the repository at this point in the history
  • Loading branch information
yoroshikun committed Aug 22, 2019
1 parent 4aa508c commit b8a6427
Show file tree
Hide file tree
Showing 59 changed files with 125 additions and 110 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ inputs:
gcloud_channel:
description: 'What GCloud snap channel to use'
default: 'stable'
service_account:
description: 'Service account to be used to active gcloud cli'
default: ''
runs:
using: 'node12'
main: 'lib/main.js'
7 changes: 7 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const exec = __importStar(require("@actions/exec"));
const fs_1 = __importDefault(require("fs"));
// TODO: Support mutiple operating systems
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
// Inputs
const gcloud_channel = core.getInput('gcloud_channel');
const service_account = core.getInput('service_account');
// Start Installing
core.debug(`Installing GCloud snap channel ${gcloud_channel}`);
// Install Gcloud Snap
yield exec.exec(`sudo snap install google-cloud-sdk --channel=${gcloud_channel} --classic`);
// Ensure root is owned
yield exec.exec('sudo chown root:root /');
// Initialize Gcloud
const SABuffer = new Buffer(service_account, 'base64');
fs_1.default.writeFileSync('gcloud.json', SABuffer);
yield exec.exec('gcloud auth activate-service-account --key-file=gcloud.json');
}
catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions node_modules/@actions/core/package.json

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

4 changes: 2 additions & 2 deletions node_modules/@actions/exec/package.json

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

4 changes: 2 additions & 2 deletions node_modules/@actions/github/package.json

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

4 changes: 2 additions & 2 deletions node_modules/@actions/io/package.json

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

4 changes: 2 additions & 2 deletions node_modules/@actions/tool-cache/package.json

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

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

4 changes: 2 additions & 2 deletions node_modules/@octokit/endpoint/package.json

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

4 changes: 2 additions & 2 deletions node_modules/@octokit/graphql/package.json

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

4 changes: 2 additions & 2 deletions node_modules/@octokit/request-error/package.json

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

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

4 changes: 2 additions & 2 deletions node_modules/@octokit/request/package.json

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

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

4 changes: 2 additions & 2 deletions node_modules/@octokit/rest/package.json

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

4 changes: 2 additions & 2 deletions node_modules/atob-lite/package.json

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

4 changes: 2 additions & 2 deletions node_modules/before-after-hook/package.json

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

4 changes: 2 additions & 2 deletions node_modules/btoa-lite/package.json

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

4 changes: 2 additions & 2 deletions node_modules/cross-spawn/node_modules/semver/package.json

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

4 changes: 2 additions & 2 deletions node_modules/cross-spawn/package.json

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

4 changes: 2 additions & 2 deletions node_modules/deepmerge/package.json

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

4 changes: 2 additions & 2 deletions node_modules/deprecation/package.json

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

Loading

0 comments on commit b8a6427

Please sign in to comment.