Use this GitHub Action to return the OCID and full URI for the specified Oracle Cloud Infrastructure Registry (OCIR) repository. If the repository does not exist, it will be created automatically.
The following OCI CLI environment variables must be defined:
OCI_CLI_USER
OCI_CLI_TENANCY
OCI_CLI_FINGERPRINT
OCI_CLI_KEY_CONTENT
OCI_CLI_REGION
We recommend using GitHub Secrets to store these values. If you have more than one step or workflow that requires these values, consider defining your environment variables at the job or workflow level.
name
: the name of the repositorycompartment
: the OCID of the compartment in which to search for or create the repository
repo_ocid
: The OCID of the repositoryrepo_path
: The full URI to the repository to be consumed directly by Docker or Podman.
This sample workflow will either create a repository named oraclelinux
in the OCI_COMPARTMENT_OCID
compartment or
retrieve the path of an existing oraclelinux
repository. The repo_path
is then used by the tag-and-push-image
step
as the target image repository for the docker push
command.
This example also uses the login-ocir
action which provides a simple mechanism for logging into OCIR using an
auth token.
jobs:
get-ocir-repository-test:
runs-on: ubuntu-22.04 Test
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: Get or create an OCIR Repository
uses: oracle-actions/[email protected]
id: get-ocir-repository
with:
name: oraclelinux
compartment: ${{ secrets.OCI_COMPARTMENT_OCID }}
- name: Log into OCIR
uses: oracle-actions/[email protected]
id: login-ocir
with:
auth_token: ${{ secrets.OCI_AUTH_TOKEN }}
- name: Tag and push a container image
id: tag-and-push-image
run: |
docker pull oraclelinux:8-slim
docker tag "oraclelinux:8-slim" "${{ steps.get-ocir-repository.outputs.repo_path }}:8-slim"
docker push "${{ steps.get-ocir-repository.outputs.repo_path }}:8-slim"
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) 2022, 2024 Oracle and/or its affiliates.
Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.