github.com/redhat-appstudio/e2e-tests@v0.0.0-20230619105049-9a422b2094d7/docs/OpenShiftCI.md (about)

     1  # Intro
     2  
     3  This document overviews the workflow for onboarding new public Red Hat App Studio repositories to the Openshift CI/Prow. Prow is the k8s-native upstream CI system, source code hosted in the kubernetes/test-infra repository. Prow interacts with GitHub to provide the automation UX that developers use on their pull requests, as well as orchestrating test workloads for those pull requests.
     4  
     5  ## Steps to create an openshift-ci jobs
     6  
     7  Openshift-ci is already enabled for all repositories in [Red Hat Appstudio organization](https://github.com/redhat-appstudio). For adding new jobs you need to create job configuration in [openshift/release](https://github.com/openshift/release) repo as described in following steps.
     8  
     9  ### Bootstrapping Configuration for a new Repository
    10  
    11  From the root of the [openshift/release](https://github.com/openshift/release) repository, run the following target and use the interactive tool to bootstrap a configuration for your repository:
    12  
    13  ``` bash
    14      make new-repo
    15  ```
    16  
    17  This should fully configure your repository, so the changes that it produces are ready to be submitted in a pull request. The resulting YAML file called $org-$repo-$branch.yaml will be found in the ci-operator/config/$org/$repo directory.
    18  
    19  ### Define tests container build root
    20  
    21  The tests in openshift-ci runs in a container. Some tests needs to install some additional tools in the tests container like kubectl, kustomize etc. In that case we need to create a Dockerfile to install those tools. Example of openshift-ci container can be found in [redhat-appstudio/infra-deployments]( https://github.com/redhat-appstudio/infra-deployments/blob/main/.ci/openshift-ci/Dockerfile).
    22  
    23  After the creation of the Dockerfile in our repo, in the release/ci-operator/config/$org/$repo we need to add to our config the new dockerfile path to make aware openshift-ci from where to build the container. Example of infra-deployments:
    24  
    25  ```yaml
    26  build_root:
    27    project_image:
    28      dockerfile_path: .ci/openshift-ci/Dockerfile
    29  ```
    30  
    31  ### Build repository containers in openshift-ci
    32  
    33  To test the latest changes in the PR in openshift-ci we need to build a container image for the tests. For that purpose we can use the `images` feature. Example:
    34  
    35  ```yaml
    36  images:
    37  - dockerfile_path: Dockerfile # the path of the repository dockerfile
    38    to: redhat-appstudio-has-image # tag of the image
    39  ```
    40  
    41  To use the image in our tests, in the test steps in config job we need to define the image dependency as environment:
    42  
    43  ```yaml
    44        dependencies:
    45        - env: HAS_CONTROLLER_IMAGE
    46          name: redhat-appstudio-has-image
    47  ```
    48  
    49  You can take a look at the [application-service](https://github.com/openshift/release/blob/master/ci-operator/config/redhat-appstudio/application-service/redhat-appstudio-application-service-main.yaml) configuration.
    50  
    51  ### Cluster Pools
    52  
    53  App Studio jobs are running using cluster pool for all jobs. Please find more information about how cluster pools work in openshift-ci in the following [docs](https://docs.ci.openshift.org/docs/architecture/ci-operator/#testing-with-a-cluster-from-a-cluster-pool).
    54  
    55  ### Define your tests
    56  
    57  Next step after configuring cluster and dependencies is to define the tests execution. Please find more information in [multi-stage](https://docs.ci.openshift.org/docs/architecture/step-registry/) tests section.
    58  
    59  ### Sanitize config and create the jobs
    60  
    61  Last steps in openshift-ci configuration is to sanitize your configuration and generating the jobs. For that we need to execute the following:
    62  
    63  ```bash
    64      make ci-operator-config # sanitize configuration
    65      make jobs # create jobs from the configuration you created in ci-operator/config/$org/$repo after executing make new-repo
    66  ```
    67  
    68  Now feel free to create your Pull request in openshift/release repo!
    69  
    70  NOTE: For more openshift-ci docs please click [here](https://docs.ci.openshift.org/docs/)