Code Monkey home page Code Monkey logo

get-ocir-repository's Introduction

get-ocir-repository

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.

Required environment variables

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.

Inputs

  • name: the name of the repository
  • compartment: the OCID of the compartment in which to search for or create the repository

Outputs

  • repo_ocid: The OCID of the repository
  • repo_path: The full URI to the repository to be consumed directly by Docker or Podman.

Sample workflow

This sample workflow will either create a repo named oraclelinux in the OCI_COMPARTMENT_OCID compartment or retrieve the path of an existing oraclelinux repo. The repo_path is then used by the tag-and-push-image step as the target image repo 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.

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) 2022 Oracle and/or its affiliates.

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

get-ocir-repository's People

Contributors

dependabot[bot] avatar djelibeybi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

saipriyabalu

get-ocir-repository's Issues

Encountering a run time execption

Error logs

##[debug]Evaluating condition for step: 'Get OCIR repository'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Get OCIR repository
##[debug]Loading inputs
##[debug]Evaluating: secrets.OCI_COMPARTMENT
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'OCI_COMPARTMENT'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run oracle-actions/[email protected]
All retry attempts have exhausted. Total Attempts : 1. Last exception occurred : Error: Cannot parse host from url
Error: Cannot parse host from url
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Get OCIR repository

Config - https://github.com/RahulMR42/oci-devops-githubactions-deploy/blob/main/.github/workflows/oci_ocr.yml

Use this action behind a proxy server

Hi guys! How are you doing?
Is it possible to use this action behind a proxy server? We have tried to set HTTP_PROXY and HTTPS_PROXY environment variables, but it did not work.
Taking a look at the code, it looks like the SDK uses the isomorphic-fetch package, that does not consider the environment variables by default. Is this understanding correct?
Thank you very much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.