Skip to content
oracle-actions

GitHub Action

Login to Oracle Cloud Infrastructure Registry (OCIR)

v1.3.0 Latest version

Login to Oracle Cloud Infrastructure Registry (OCIR)

oracle-actions

Login to Oracle Cloud Infrastructure Registry (OCIR)

Log Docker and Podman into your Oracle Cloud Infrastructure Registry instance

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Login to Oracle Cloud Infrastructure Registry (OCIR)

uses: oracle-actions/login-ocir@v1.3.0

Learn more about this action in oracle-actions/login-ocir

Choose a version

login-ocir

GitHub Action that logs into the Oracle Cloud Infrastructure Registry (OCIR) endpoint in the Oracle Cloud Infrastructure (OCI) region and using the credentials provided via the required environment variables.

The login credentials are provided to both the Docker and Podman container tools, so you may use either of them in the subsequent workflow steps.

Required environment variables

The following OCI CLI environment variables must be defined for the login-ocir task to work:

  • 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 OCI-related task, consider defining your environment variables at the job or workflow level.

Inputs

  • auth_token: an Oracle-generated string that allow third-party services to authenticate to OCI service endpoints. See working with Auth Tokens for details on how to create a token.

Outputs

  • ocir_endpoint
  • ocir_username

Sample workflow

This sample workflow uses the login-ocir action which uses the provided OCI_AUTH_TOKEN to login to OCIR as well as the get-ocir-repository action to retrieve the path of an existing repository.

jobs:
  get-ocir-repository-test:
    runs-on: ubuntu-22.04
    name: Get OCIR Repository 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/get-ocir-repository@v1.3.0
        id: get-ocir-repository
        with:
          name: oraclelinux
          compartment: ${{ secrets.OCI_COMPARTMENT_OCID }}

      - name: Log into OCIR
        uses: oracle-actions/login-ocir@v1.3.0
        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.

Contributing

We welcome contributions from the community. Before submitting a pull request, please review our contribution guide.

Security

Please consult the security guide for our responsible security vulnerability disclosure process.

License

Copyright (c) 2021, 2022 Oracle and/or its affiliates.

Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.