Skip to content

Latest commit

 

History

History
141 lines (80 loc) · 4.1 KB

File metadata and controls

141 lines (80 loc) · 4.1 KB

A sample illustration of Gitlab code repo integration with OCI Devops.


Objectives

  • Create a sample project and personal access token with Gitlab.
  • Create vault ,policies as accordingly.
  • Create a devops connection and integrate with OCI.
  • Test and validate the integrations.
  • Specific instruction to clone only this example.

    $ git init oci-devops-coderepo-with-gitlab
    $ cd oci-devops-coderepo-with-gitlab
    $ git remote add origin https://github.com/oracle-devrel/oci-devops-examples
    $ git config core.sparsecheckout true
    $ echo "oci-coderepo-examples/oci-devops-coderepo-with-gitlab/*">>.git/info/sparse-checkout
    $ git pull --depth=1 origin main
    
    

Procedure

  • Click on the Gitlab profile icon and select Edit profile option.

  • Click Access Tokens

  • Provide a token name and an Expiration date (optional).

  • Select a scope read_api.

  • Click Create personal access token and make a note of the token.

  • Create a new Encryption Key.

  • Create a new secrets and store the Gitlab - PAT.

  • Create a Dynamic group with below rules .
ALL {resource.type = 'devopsconnection', resource.compartment.id = 'COMPARMENT OCID'}
ALL {resource.type = 'devopsrepository', resource.compartment.id = 'COMPARMENT OCID'}

  • Create a policy (Ensure to create it under the ROOT of tenancy) for the dynamic groups with below policy statement.
Allow dynamic-group <NAME OF THE DG> to read secret-family in compartment <compartment name>
Allow dynamic-group <NAME OF THE DG> to use devops-connection in compartment <compartment name>

  • Under the project click Enable Logging and toggle and enable the logs.

  • Select the logging details and enable .

  • Select the type as GitLab and associate with the Vault and secret created.

  • Select the external connection created and select the Gitlab repository. You may mention a custom name (as optional) which will be used when the external repo is cloned to OCI Code repo.

  • You may alter the Scheduling type to a custom value if needed .The default sync is 15 minutes.

  • After a while the repo will be available via OCI Code Repo

Contributors

  • Author : Rahul M R.
  • Collaborators : NA
  • Last release : Apr 2022

Back to examples.