You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This GitHub Action installs the OCI CLI and then runs the specified command.
4
-
This action will automatically cache the OCI CLI install to speed up any
5
-
subsequent steps that use this action.
3
+
This GitHub Action installs the OCI CLI and then runs the specified command. This action will automatically cache the OCI CLI install to speed up any subsequent steps that use this action.
6
4
7
5
## Required environment variables
8
6
9
-
The following [OCI CLI environment variables][1] must be defined for at least
10
-
the `run-oci-cli-command` task:
7
+
The following [OCI CLI environment variables][1] must be defined for at least the `run-oci-cli-command` task:
11
8
12
9
*`OCI_CLI_USER`
13
10
*`OCI_CLI_TENANCY`
14
11
*`OCI_CLI_FINGERPRINT`
15
12
*`OCI_CLI_KEY_CONTENT`
16
13
*`OCI_CLI_REGION`
17
14
18
-
We recommend using GitHub Secrets to store these values. If you have more than
19
-
one `run-oci-cli-command` task, consider [defining your environment variables][2] at
20
-
the job or workflow level.
15
+
We recommend using GitHub Secrets to store these values. If you have more than one `run-oci-cli-command` task, consider [defining your environment variables][2] at the job or workflow level.
21
16
22
17
## Inputs
23
18
24
19
*`command` (required): the [command and arguments][3] to provide to the `oci` tool.
25
-
*`query`: (optional) a [JMESPath query](http://jmespath.org/) to run on the
26
-
response JSON before output.
20
+
*`query`: (optional) a [JMESPath query][4] to run on the response JSON before output.
27
21
28
22
### Output masking
29
23
30
-
By default, the output(s) from the command are masked from the GitHub Actions log
31
-
and GitHub console, to prevent leaking any credential or confidential information.
32
-
The following option will disable that masking and is intended for debugging
33
-
purposes only:
24
+
By default, the output(s) from the command are masked from the GitHub Actions log and GitHub console, to prevent leaking any credential or confidential information. The following option will disable that masking and is intended for debugging purposes only:
34
25
35
-
*`silent`: (Optional; default: _true_) If set to _false_ the action will
36
-
not mask or suppress the command or outputs from the logs or console.
26
+
*`silent`: (Optional; default: _true_) If set to _false_ the action will not mask or suppress the command or outputs from the logs or console.
37
27
38
-
> **Note:** the output does not need to be visible in the log to be used as an
39
-
> input by another task.
28
+
> **Note:** the output does not need to be visible in the log to be used as an > input by another task.
40
29
41
30
## Outputs
42
31
43
32
*`output`: will contain the results of the command in JSON format.
44
-
*`raw_output`: if the output of a given query is a single string value, this
45
-
will return the string without surrounding quotes.
33
+
*`raw_output`: if the output of a given query is a single string value, this will return the string without surrounding quotes.
46
34
47
-
> **Note:** filtering the `output` or `raw_output` by piping it through another
48
-
> tool like `jq` may result in the filtered output being visible in the job
49
-
> logs. _Using a JMESPath query to filter results is recommend instead_.
35
+
> **Note:** filtering the `output` or `raw_output` by piping it through another tool like `jq` may result in the filtered output being visible in the job logs. We recommend using the `query` parameter instead.
50
36
51
37
## Sample workflow
52
38
39
+
The following example lists all compute instances found in the `testing` compartment of the `OCI_CLI_TENANCY` in the `OCI_CLI_REGION` region.
40
+
41
+
To change the name of the compartment, modifying the `query` parameter of the `find-compartment-id` step.
42
+
43
+
To change which fields are returned, modify the `query` parameter of the `find-instasnces` step.
44
+
53
45
```yaml
54
46
jobs:
55
47
my-instances:
@@ -63,25 +55,25 @@ jobs:
63
55
OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }}
64
56
steps:
65
57
- name: Retrieve the OCID of a named compartment in tenancy
66
-
uses: oracle-actions/run-oci-cli-command@v1
67
-
id: get-compartment-ocid
58
+
uses: oracle-actions/run-oci-cli-command@v1.0
59
+
id: find-compartment-id
68
60
with:
69
-
command: 'iam compartment list'
70
-
jmespath: "data[?name=='my-compartment'].id"
61
+
command: 'iam compartment list --compartment-id-in-subtree=true'
62
+
query: "data[?name=='testing'].id"
71
63
72
64
- name: Retrieve the display name and shape of the instances in my compartment
73
65
uses: oracle-actions/run-oci-cli-command@v1.0
74
-
id: find-my-instances-instances
66
+
id: find-instances
75
67
with:
76
-
command: 'compute instance list --compartment-id ${{ steps.compartment-ocid.get-compartment-ocid.raw_output }}'
See [`action.yml`](./action.yml) for more details.
76
+
Consult the [JMESPath documentation][4] for details on how to create more complex queries and result formatting and [`action.yml`](./action.yml) for more detail on how to configure this action..
85
77
86
78
## Contributing
87
79
@@ -103,3 +95,4 @@ Released under the Universal Permissive License v1.0 as shown at
0 commit comments