|
| 1 | +# Local development environment |
| 2 | + |
| 3 | +This document provides instructiion on how to set up an environment for "local" |
| 4 | +development of the Operator Pipelines project. |
| 5 | + |
| 6 | +The word "local" in this context means that developer will use existing stage |
| 7 | +operator pipelines cluster and use a custom namespace for development. |
| 8 | + |
| 9 | +## Setup & Deployment |
| 10 | + |
| 11 | +A operator pipelines interact with Github repositories (certified, marketplace and |
| 12 | +community). It is highly recomended to `fork` the upstream repository and only work |
| 13 | +on your fork. |
| 14 | + |
| 15 | +1. Fork the upstream repository: |
| 16 | + 1. [Certified Operators](https://github.com/redhat-openshift-ecosystem/certified-operators-preprod/) |
| 17 | + 2. [Community Operators](https://github.com/redhat-openshift-ecosystem/community-operators-pipeline-preprod) |
| 18 | +2. Set environment variables referencing your fork: |
| 19 | + 1. Create `.env` file in the root of the repository. |
| 20 | + 2. Add the following variables to the `.env` file: |
| 21 | + 1. `GITHUB_USER` - your GitHub username |
| 22 | +3. Sign in to the OpenShift cluster using `oc` CLI: |
| 23 | + ```bash |
| 24 | + oc login --web --server=https://api.pipelines-stage.0ce8.p1.openshiftapps.com:6443 |
| 25 | + ``` |
| 26 | +4. Use a `Makefile` to build and deploy your namespace: |
| 27 | + 1. `make deploy-playground` |
| 28 | + 2. This will create a new namespace `$(USER)-playground` and deploy the operator pipelines |
| 29 | + to it. |
| 30 | +5. Add a Github webhook to your forked repositories: |
| 31 | + 1. Go to your forked repository settings. |
| 32 | + 2. Add a new webhook with the following settings: |
| 33 | + - **Payload URL**: `https://webhook-dispatcher-$(USER)-playground.operator-pipeline-stage.apps.pipelines-stage.0ce8.p1.openshiftapps.com/api/v1/webhooks/github-pipeline` |
| 34 | + - **Content type**: `application/json` |
| 35 | + - **Secret**: Use the value from `ansible/vaults/common/github-webhook-secret-preprod.txt`. |
| 36 | + - **Which events would you like to trigger this webhook?**: Select "Let me select individual events" and check "Pull requests and Labels". |
| 37 | + - **Active**: Ensure the webhook is active. |
| 38 | + |
| 39 | +## Trigger a pipeline event |
| 40 | +Once the environment is set up, you can submit a new pull request to your forked repository. |
| 41 | +When opening your PR you need to target the branch `$USER` (the same as your local user). |
| 42 | +This will trigger the webhook and start the operator pipelines and process the pull request. |
| 43 | + |
| 44 | +After a moment you should see the pipeline running in the OpenShift console and also see |
| 45 | +firts interaction in the PR comments and labels being added to the PR. |
0 commit comments