Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/getporter/gcloud-mixin
Porter mixin for the gcloud CLI
https://github.com/getporter/gcloud-mixin
gcloud google mixin porter
Last synced: 4 months ago
JSON representation
Porter mixin for the gcloud CLI
- Host: GitHub
- URL: https://github.com/getporter/gcloud-mixin
- Owner: getporter
- License: apache-2.0
- Created: 2019-08-03T22:32:42.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-06-11T00:19:55.000Z (5 months ago)
- Last Synced: 2024-06-20T11:12:56.232Z (5 months ago)
- Topics: gcloud, google, mixin, porter
- Language: Go
- Homepage: https://getporter.org/mixins/gcloud
- Size: 2.47 MB
- Stars: 4
- Watchers: 7
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-cnab - gcloud-mixin - Porter mixin for the gcloud CLI by @get_porter (Implementations / Porter)
README
# gcloud CLI Mixin for Porter
This is a mixin for Porter that provides the gcloud CLI.
[![porter/gcloud-mixin](https://github.com/getporter/gcloud-mixin/actions/workflows/gcloud-mixin.yml/badge.svg)](https://github.com/getporter/gcloud-mixin/actions/workflows/gcloud-mixin.yml)
## Mixin Syntax
See the [gcloud CLI Command Reference](https://cloud.google.com/sdk/gcloud/reference/) for the supported commands
```yaml
gcloud:
description: "Description of the command"
groups: GROUP
command: COMMAND
arguments:
- arg1
- arg2
flags:
FLAGNAME: FLAGVALUE
REPEATED_FLAG:
- FLAGVALUE1
- FLAGVALUE2
suppress-output: false
outputs:
- name: NAME
jsonPath: JSONPATH
```You can also specify a list of `groups`:
```yaml
gcloud:
description: "Description of the command"
groups:
- GROUP 1
- GROUP 2
command: COMMAND
```### Suppress Output
The `suppress-output` field controls whether output from the mixin should be
prevented from printing to the console. By default this value is false, using
Porter's default behavior of hiding known sensitive values. When
`suppress-output: true` all output from the mixin (stderr and stdout) are hidden.Step outputs (below) are still collected when output is suppressed. This allows
you to prevent sensitive data from being exposed while still collecting it from
a command and using it in your bundle.### Outputs
The mixin supports `jsonpath` outputs.
#### JSON Path
The `jsonPath` output treats stdout like a json document and applies the expression, saving the result to the output.
```yaml
outputs:
- name: NAME
jsonPath: JSONPATH
```For example, if the `jsonPath` expression was `$[*].id` and the command sent the following to stdout:
```json
[
{
"id": "1085517466897181794",
"name": "my-vm"
}
]
```Then then output would have the following contents:
```json
["1085517466897181794"]
```---
## Examples
### Authenticate
```yaml
gcloud:
description: "Authenticate"
groups:
- auth
command: activate-service-account
flags:
key-file: gcloud.json
```### Provision a VM
```yaml
gcloud:
description: "Create VM"
groups:
- compute
- instances
command: create
arguments:
- porter-test
flags:
project: porterci
zone: us-central1-a
machine-type: f1-micro
image: debian-9-stretch-v20190729
image-project: debian-cloud
boot-disk-size: 10GB
boot-disk-type: pd-standard
boot-disk-device-name: porter-test
outputs:
- name: vms
jsonPath: "$[*].id"
```### Configure SSH Keys
```yaml
gcloud:
description: "Configure SSH"
groups: compute
command: config-ssh
flags:
ssh-config-file: ./gce-ssh-config
ssh-key-file: ./gce-ssh-key
```