Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 3.84 KB

README.md

File metadata and controls

46 lines (37 loc) · 3.84 KB

optic-release-automation-app

ci cd

An helper application that simply creates release PRs to the requesting repo. This app is intended to be used with optic-release-automation-action.

Documentation

The Optic documentation is available on the website

To get started, visit the Getting Started page for a brief overview.

Development

This section covers how to contribute to this app. You don't need to read further if you're simply using this as described in the above sections.

  • Prerequisites: a GCP project with the cloud run and cloud build apis enabled
  • Create a service account in the IAM & Admin console to be used to deploy the app
  • Create a key for the service account, this key will be configured as a secret in the GitHub actions to be able to deploy the app
  • Grant following permissions for the service account
    • Artifact Registry Administrator
    • Cloud Build Service Account
    • Service Account User
    • Cloud Run Admin
    • Cloud Run Service Agent
    • Storage Admin
  • Clone this repo to your GitHub account
  • In the Settings of your GitHub repo, go to Secrets and create the New repository secret with the names and values below:
    • GCP_PROJECT_ID: The ID of the GCP project as found in your GCP Account
    • GCP_CLOUDRUN_SERVICE_NAME: The name of the cloud run service, you can select any name that you prefer
    • GCP_CLOUDRUN_SERVICE_REGION: The region in the GCP that you want to create the cloud run service
    • GCP_SA_KEY: The key that you created for your service account with the permissions to deploy the app. This is a JSON object and should be used as-is.
    • APP_ID: The ID of the GitHub App. You can get this from the GitHub app settings. The default app is here
    • PRIVATE_KEY: The private key of the GitHub App. You can get this from the GitHub app settings. The default app is here
  • After the steps above are configured, go to Actions in your GitHub repo and run the CD workflow that is created in the folder .github/workflows/cd.yaml. The file is already configured with the action to deploy the cloud run service using the secrets that were created in the step above.
  • Once the workflow run, go to you GCP Account and open the "Cloud Run" page to see the details of the deployed service.

Testing changes locally

This section covers how to run the app locally using ngrok to test your changes while developing a new feature or debugging an issue

  • Create a new github app and add the following permissions:
    • Contents: Read and write
    • Pull requests: Read and write
  • Then go to Install App and install it on your repository
  • Start the server and run ngrok http 3000 on your local machine and get the public URL. This will be your API url, which needs to be set as the webhook URL on your github app and to be passed as the api-url input for the optic-release-automation-action.
  • You should also pass the name of your bot as the app-name to the action. This is used after a PR is merged to check whether it was created by optic and whether we should proceed running the action on that PR