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.
The following OCI CLI environment variables must be defined for at least the run-oci-cli-command task:
OCI_CLI_USEROCI_CLI_TENANCYOCI_CLI_FINGERPRINTOCI_CLI_KEY_CONTENTOCI_CLI_REGION
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 at the job or workflow level.
command(required): the command and arguments to provide to theocitool.query: (optional) a JMESPath query to run on the response JSON before output.
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:
silent: (Optional; default: true) If set to false the action will not mask or suppress the command or outputs from the logs or console.
Note: the output does not need to be visible in the log to be used as an input by another task.
output: will contain the results of the command in JSON format.raw_output: if the output of a given query is a single string value, this will return the string without surrounding quotes.
Note: filtering the
outputorraw_outputby piping it through another tool likejqmay result in the filtered output being visible in the job logs. Using a JMESPath query to filter results is recommend instead.
jobs: my-instances: runs-on: ubuntu-latest name: List the display name and shape of the instances in my compartment env: OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }} OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }} OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }} OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }} OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }} steps: - name: Retrieve the OCID of a named compartment in tenancy uses: oracle-actions/run-oci-cli-command@v1 id: get-compartment-ocid with: command: 'iam compartment list' jmespath: "data[?name=='my-compartment'].id" - name: Retrieve the display name and shape of the instances in my compartment uses: oracle-actions/run-oci-cli-command@v1 id: find-my-instances-instances with: command: 'compute instance list --compartment-id ${{ steps.compartment-ocid.get-compartment-ocid.raw_output }}' jmespath: 'data[*].{name: \"display-name\", shape: shape}' - name: List the display name and shape of the instances in my compartment run: | echo ${{ steps.find-my-compartment-instances.outputs.output }} | jq .See action.yml for more details.
We welcome contributions from the community. Before submitting a pull request, please review our contribution guide.
Please consult the security guide for our responsible security vulnerability disclosure process.
Copyright (c) 2021 Oracle and/or its affiliates.
Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.