oracle-actions / run-oci-cli-command Goto Github PK
View Code? Open in Web Editor NEWRun Oracle Cloud Infrastructure (OCI) CLI commands
License: Universal Permissive License v1.0
Run Oracle Cloud Infrastructure (OCI) CLI commands
License: Universal Permissive License v1.0
GitHub runners now have Node.js 20 installed.
https://github.com/mikarinneoracle/github-actions-oci/blob/main/.github/workflows/oci.yml
have the secrets, values are copied from my local .oci config that works fine
Error:
The process '/home/runner/.local/bin/oci' failed with exit code 1
Can we use this GitHub plugin to generate a wallet using the oci-cli
. To be exact: db autonomous-database generate-wallet
?
Hello,
Running (command and result copy pasted from the output):
with:
command: network route-table update --force --route-rules '[{"destination":"0.0.0.0/0","destinationType":"CIDR_BLOCK","networkEntityId":"ocid1.internetgateway.oc1"}]' --rt-id "ocid1.routetable.oc1"
query: data
silent: false
creates this cmd with errors:
Executing Oracle Cloud Infrastructure CLI command
/home/runner/.local/bin/oci network route-table update --force --route-rules '[{destination:0.0.0.0/0,destinationType:CIDR_BLOCK,networkEntityId:ocid1.internetgateway.oc1]' -rt-id ocid1.routetable.oc1
Parameter 'route_rules' must be in JSON format.
For help with formatting JSON input see our documentation here: https://docs.cloud.oracle.com/iaas/Content/API/SDKDocs/cliusing.htm#ManagingCLIInputandOutput
Can you please provide a solution to overcome this?
Thank you
Hi
I am using OCI CLI in Github Actions to create a VCN. I am trying to pass the VCN ID to the next step which is to create Internet gateway. But the VCN ID outputted is masked. Hence, the Internet Gateway is unable to create because the VCN ID is masked.
How to pass outputs from commands to subsequent commands?
Please find the code below.
Thanks in advance!
Code:
- name: OCI VCN Creation
uses: oracle-actions/[email protected]
id: find-vcn-id
with:
silent: 'False'
command: 'oci network vcn create --cidr-block ${{ github.event.inputs.VCN_cidr_block }} --compartment-id ${{ github.event.inputs.compartment-id }} --display-name "GitHub-Action-VCN" --region ${{ secrets.OCI_REGION }}'
query: 'data.id'
- name: Get VCN Id
run: |
echo ${{ steps.find-vcn-id.outputs.output }} | jq .
- name: OCI VCN Igw creation
uses: oracle-actions/[email protected]
id: find-IGW-id
with:
silent: 'False'
command: 'oci network internet-gateway create --compartment-id ${{ github.event.inputs.compartment-id }} --is-enabled "true" --vcn-id ${{ steps.find-vcn-id.outputs.output }} --display-name "IGW1" --region ${{ secrets.OCI_REGION }} --output "json" --debug'
query: 'data.id'
- name: Get IGW Id
run: |
echo ${{ steps.find-IGW-id.outputs.output }} | jq .
Every time the action runs it outputs 2 Deprecation warnings/notices and urges the action to be updated
Node.js 12 actions are deprecated.
For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.
Please update the following actions to use Node.js 16: oracle-actions/run-oci-cli-command
and
The `set-output` command is deprecated and will be disabled soon.
Please upgrade to using Environment Files.
For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
When a successful response is found from the OCI CLI, it will always try and JSON parse a response - as in the code
const stdout = cliResult.stdout ? JSON.parse(cliResult.stdout) : {};
Commands such as oci ce cluster create-kubeconfig
do not respond with JSON. See below for a failed response when running this command:
Run oracle-actions/[email protected]
Installing Oracle Cloud Infrastructure CLI
Executing Oracle Cloud Infrastructure CLI command
/home/runner/.local/bin/oci ce cluster create-kubeconfig --cluster-id *** --file $HOME/.kube/config --region *** --token-version 2.0.0 --kube-endpoint PUBLIC_ENDPOINT
New config written to the Kubeconfig file /home/runner/.kube/config
Error: Unexpected token N in JSON at position 0
Would there be a way to force a JSON response from the CLI or should we have some logic to see if the response is JSON and if not, don't parse the response. Happy to open a PR if this is the logical path to go down to solve this.
I'm also not too familiar with the API and if this would happen on any other commands - not sure how widespread this issue would be.
Error
1s
Current runner version: '2.294.0'
Operating System
Virtual Environment
Virtual Environment Provisioner
GITHUB_TOKEN Permissions
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Getting action download info
Error: Unable to resolve action `oracle-actions/run-oci-cli-command@v[1](https://github.com/RahulMR42/oci-devops-githubactions-deploy/runs/7392607794?check_suite_focus=true#step:1:1)`, unable to find version `v1`
Config - https://github.com/RahulMR42/oci-devops-githubactions-deploy/blob/main/.github/workflows/oci_iam.yml
Please guide us .Thanks alot .
I tried yaml example reported on README, but I get a fail on the first execution step.
Installing Oracle Cloud Infrastructure CLI
/usr/bin/python -m pip install oci-cli
Defaulting to user installation because normal site-packages is not writeable
Collecting oci-cli
Downloading oci_cli-3.21.0-py3-none-any.whl (33.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 33.6/33.6 MB 84.8 MB/s eta 0:00:00
Collecting pyOpenSSL>=22.1.0
Downloading pyOpenSSL-22.1.0-py3-none-any.whl (57 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.0/57.0 KB 24.3 MB/s eta 0:00:00
Collecting oci==2.89.0
Downloading oci-2.89.0-py2.py3-none-any.whl (18.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.5/18.5 MB 125.5 MB/s eta 0:00:00
Collecting jmespath==0.10.0
Downloading jmespath-0.10.0-py2.py3-none-any.whl (24 kB)
Requirement already satisfied: six>=1.15.0 in /usr/lib/python3/dist-packages (from oci-cli) (1.16.0)
Collecting click==7.1.2
Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.8/82.8 KB 30.7 MB/s eta 0:00:00
Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from oci-cli) (2020.6.20)
Requirement already satisfied: pytz>=2016.10 in /usr/lib/python3/dist-packages (from oci-cli) (2022.1)
Collecting prompt-toolkit==3.0.29
Downloading prompt_toolkit-3.0.29-py3-none-any.whl (381 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 381.5/381.5 KB 95.8 MB/s eta 0:00:00
Collecting terminaltables==3.1.0
Downloading terminaltables-3.1.0.tar.gz (12 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: PyYAML<6,>=5.4 in /usr/lib/python3/dist-packages (from oci-cli) (5.4.1)
Collecting arrow>=1.0.0
Downloading arrow-1.2.3-py3-none-any.whl (66 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.4/66.4 KB 27.5 MB/s eta 0:00:00
Requirement already satisfied: cryptography<=39.0.0,>=3.2.1 in /usr/lib/python3/dist-packages (from oci-cli) (3.4.8)
Collecting python-dateutil<3.0.0,>=2.5.3
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 KB 63.4 MB/s eta 0:00:00
Collecting circuitbreaker<2.0.0,>=1.3.1
Downloading circuitbreaker-1.4.0.tar.gz (9.7 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting wcwidth
Downloading wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Collecting cryptography<=39.0.0,>=3.2.1
Downloading cryptography-38.0.4-cp36-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 149.4 MB/s eta 0:00:00
Collecting cffi>=1.12
Downloading cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 441.8/441.8 KB 105.2 MB/s eta 0:00:00
Collecting pycparser
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 KB 54.2 MB/s eta 0:00:00
Building wheels for collected packages: terminaltables, circuitbreaker
Building wheel for terminaltables (setup.py): started
Building wheel for terminaltables (setup.py): finished with status 'done'
Created wheel for terminaltables: filename=terminaltables-3.1.0-py3-none-any.whl size=15355 sha256=e67752bfc9a82d960a38dd3482d50972a563e42ed4ba558dcf1ce3725f367ecb
Stored in directory: /home/runner/.cache/pip/wheels/0e/e1/98/126eccfa07627229dd8299be9445fcf626f52e636268996bb6
Building wheel for circuitbreaker (setup.py): started
Building wheel for circuitbreaker (setup.py): finished with status 'done'
Created wheel for circuitbreaker: filename=circuitbreaker-1.4.0-py3-none-any.whl size=7522 sha256=786f[13](https://github.com/FauFra/cicloturismo/actions/runs/3669110704/jobs/6202702752#step:2:14)476968dc76cf3873f9e5ae9b5dcbd86231d542[15](https://github.com/FauFra/cicloturismo/actions/runs/3669110704/jobs/6202702752#step:2:16)bc0350ac55c3697da6
Stored in directory: /home/runner/.cache/pip/wheels/3c/be/64/266b6ce2ef1130de5e4[19](https://github.com/FauFra/cicloturismo/actions/runs/3669110704/jobs/6202702752#step:2:20)f04805acbb2df5a4ab1b91348f25b
Successfully built terminaltables circuitbreaker
Installing collected packages: wcwidth, terminaltables, circuitbreaker, python-dateutil, pycparser, prompt-toolkit, jmespath, click, cffi, arrow, cryptography, pyOpenSSL, oci, oci-cli
Successfully installed arrow-1.2.3 cffi-1.15.1 circuitbreaker-1.4.0 click-7.1.2 cryptography-38.0.4 jmespath-0.10.0 oci-2.89.0 oci-cli-3.[21](https://github.com/FauFra/cicloturismo/actions/runs/3669110704/jobs/6202702752#step:2:22).0 prompt-toolkit-3.0.29 pyOpenSSL-[22](https://github.com/FauFra/cicloturismo/actions/runs/3669110704/jobs/6202702752#step:2:23).1.0 pycparser-2.21 python-dateutil-2.8.2 terminaltables-3.1.0 wcwidth-0.2.5
Executing Oracle Cloud Infrastructure CLI command
Error: The process '/home/runner/.local/bin/oci' failed with exit code 1
steps
snippet is
steps:
- name: Retrieve the OCID of a named compartment in tenancy
uses: oracle-actions/[email protected]
id: find-compartment-id
with:
command: 'iam compartment list --compartment-id-in-subtree=true'
query: "data[?name=='testing'].id"
- name: Retrieve the display name and shape of the instances in my compartment
uses: oracle-actions/[email protected]
id: find-instances
with:
command: 'compute instance list --compartment-id ${{ steps.find-compartment-id.outputs.raw_output }}'
query: '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 .
32s
Run oracle-actions/[email protected]
Installing Oracle Cloud Infrastructure CLI
Executing Oracle Cloud Infrastructure CLI command
Error: The process '/home/runner/.local/bin/oci' failed with exit code 1
Error
Installing Oracle Cloud Infrastructure CLI
/usr/bin/python -m pip install oci-cli
Collecting oci-cli
Downloading oci_cli-3.11.1-py3-none-any.whl (30.9 MB)
Collecting terminaltables==3.1.0
Downloading terminaltables-3.1.0.tar.gz (12 kB)
Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from oci-cli) (2019.11.28)
Collecting six>=1.15.0
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting PyYAML<6,>=5.4
Downloading PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl (662 kB)
Collecting jmespath==0.10.0
Downloading jmespath-0.10.0-py2.py3-none-any.whl (24 kB)
Collecting prompt-toolkit==3.0.29
Downloading prompt_toolkit-3.0.29-py3-none-any.whl (381 kB)
Collecting pytz>=2016.10
Downloading pytz-2022.1-py2.py3-none-any.whl (503 kB)
Collecting click==7.1.2
Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
Requirement already satisfied: pyOpenSSL<=22.0.0,>=17.5.0 in /usr/lib/python3/dist-packages (from oci-cli) (19.0.0)
Collecting python-dateutil<3.0.0,>=2.5.3
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting arrow>=1.0.0
Downloading arrow-1.2.2-py3-none-any.whl (64 kB)
Collecting oci==2.75.1
Downloading oci-2.75.1-py2.py3-none-any.whl (16.6 MB)
Collecting cryptography<=37.0.2,>=3.2.1
Downloading cryptography-37.0.2-cp36-abi3-manylinux_2_17_x86_64.manylinux20[14](https://github.com/RahulMR42/oci-devops-githubactions-deploy/runs/7449224441?check_suite_focus=true#step:2:15)_x86_64.whl (4.1 MB)
Collecting wcwidth
Downloading wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Collecting circuitbreaker<2.0.0,>=1.3.1
Downloading circuitbreaker-1.4.0.tar.gz (9.7 kB)
Collecting cffi>=1.12
Downloading cffi-1.[15](https://github.com/RahulMR42/oci-devops-githubactions-deploy/runs/7449224441?check_suite_focus=true#step:2:16).1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (442 kB)
Collecting pycparser
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
Building wheels for collected packages: terminaltables, circuitbreaker
Building wheel for terminaltables (setup.py): started
Building wheel for terminaltables (setup.py): finished with status 'done'
Created wheel for terminaltables: filename=terminaltables-3.1.0-py3-none-any.whl size=15354 sha256=f3f6b1ae1a462c2c19122f90331c0f486d9fd9c6186bec90cfef2c7c7ea36f7e
Stored in directory: /home/runner/.cache/pip/wheels/08/8f/5f/253d0105a55bd84ee61ef0d37dbf70421e61e0cd70cef7c5e1
Building wheel for circuitbreaker (setup.py): started
Building wheel for circuitbreaker (setup.py): finished with status 'done'
Created wheel for circuitbreaker: filename=circuitbreaker-1.4.0-py3-none-any.whl size=7503 sha256=db4bda1df34ce4a9369bd742502bf19db4cd94867e2d935d1ea3e87474d34d41
Stored in directory: /home/runner/.cache/pip/wheels/52/06/a4/3f1cdbebf72c6da0c6e0074d5f4f54bebfa6c479ca6cb56e9d
Successfully built terminaltables circuitbreaker
ERROR: launchpadlib 1.10.13 requires testresources, which is not installed.
Installing collected packages: terminaltables, six, PyYAML, jmespath, wcwidth, prompt-toolkit, pytz, click, python-dateutil, arrow, circuitbreaker, pycparser, cffi, cryptography, oci, oci-cli
Successfully installed PyYAML-5.4.1 arrow-1.2.2 cffi-1.15.1 circuitbreaker-1.4.0 click-7.1.2 cryptography-37.0.2 jmespath-0.10.0 oci-2.75.1 oci-cli-3.11.1 prompt-toolkit-3.0.29 pycparser-2.21 python-dateutil-2.8.2 pytz-2022.1 six-1.[16](https://github.com/RahulMR42/oci-devops-githubactions-deploy/runs/7449224441?check_suite_focus=true#step:2:17).0 terminaltables-3.1.0 wcwidth-0.2.5
Executing Oracle Cloud Infrastructure CLI command
Error: The process '/home/runner/.local/bin/oci' failed with exit code 1
Config -
https://github.com/RahulMR42/oci-devops-githubactions-deploy/blob/main/.github/workflows/oci_iam.yml
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.