github.com/operator-framework/operator-lifecycle-manager@v0.30.0/.github/workflows/e2e-tests.yml (about)

     1  name: e2e
     2  on:
     3    schedule:
     4      - cron: '30 5,17 * * *' # run this every day at 5:30 and 17:30 UTC (00:30 and 12:30 ET)
     5    push:
     6      branches:
     7        - master
     8    pull_request:
     9    workflow_dispatch:
    10    merge_group:
    11  jobs:
    12  
    13    # Build the OLM image and save it as an artifact
    14    build:
    15      runs-on: ubuntu-latest
    16      outputs:
    17        sha: ${{ steps.vars.outputs.sha }}
    18      steps:
    19        # checkout code and setup go
    20        - uses: actions/checkout@v4
    21        - uses: actions/setup-go@v5
    22          with:
    23            go-version-file: "go.mod"
    24        # build binaries and image for e2e test (includes experimental features)
    25        - name: Build controller image
    26          run: make e2e-build
    27        - name: Save image
    28          run: docker save quay.io/operator-framework/olm:local -o olm-image.tar
    29        - name: Upload Docker image as artifact
    30          uses: actions/upload-artifact@v4
    31          with:
    32            name: olm-image.tar
    33            path: olm-image.tar
    34  
    35    # Run e2e tests in parallel jobs
    36    # Take olm image from the previous stage
    37    e2e:
    38      needs: build
    39      strategy:
    40        fail-fast: false
    41        matrix:
    42          parallel-id: [0, 1, 2, 3]
    43      runs-on: ubuntu-latest
    44      env:
    45        # absolute path to test artifacts directory
    46        ARTIFACT_DIR: ${{ github.workspace }}/artifacts
    47        E2E_TEST_CHUNK: ${{ matrix.parallel-id }}
    48        E2E_NODES: 2
    49        E2E_KUBECONFIG_ROOT: ${{ github.workspace }}/kubeconfigs
    50      steps:
    51        # checkout code and setup go
    52        - uses: actions/checkout@v4
    53        - uses: actions/setup-go@v5
    54          with:
    55            go-version-file: "go.mod"
    56  
    57        # load the olm image
    58        - name: Load OLM Docker image
    59          uses: actions/download-artifact@v4
    60          with:
    61            name: olm-image.tar
    62            path: .
    63        - run: docker load < olm-image.tar
    64  
    65        # set e2e environment variables
    66        # Set ginkgo output and parallelism
    67        - run: echo "GINKGO_OPTS=-output-dir ${ARTIFACT_DIR} -junit-report junit_e2e.xml -nodes ${E2E_NODES}" >> $GITHUB_ENV
    68  
    69        # Setting -kubeconfig-root tells the e2e test suite to look for kubeconfigs
    70        # in <kubeconfig-root>/kubeconfig-<node-number>
    71        # This is used to run tests in parallel on multiple clusters as the current e2e
    72        # test suite does not support running tests in parallel on a single cluster
    73        - run: echo "E2E_OPTS=-kubeconfig-root=${E2E_KUBECONFIG_ROOT}" >> $GITHUB_ENV
    74  
    75        # run e2e tests
    76        # create artifacts directory
    77        - run: mkdir -p ${ARTIFACT_DIR}
    78  
    79        # deploy test clusters
    80        - name: Deploy test cluster(s)
    81          # create kubeconfig root and store the kubeconfig for each cluster within it as you create the clusters
    82          # Add kind and helm options to specify kubeconfig location
    83          # Deploy the new cluster and helm install olm for testing
    84          run: |
    85            mkdir -p ${E2E_KUBECONFIG_ROOT}
    86            for i in $(seq 1 ${E2E_NODES}); do
    87              KIND_CLUSTER_NAME="kind-olmv0-${i}" \
    88              KIND_CREATE_OPTS="--kubeconfig=${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}" \
    89              HELM_INSTALL_OPTS="--kubeconfig ${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}" \
    90              make kind-create deploy;
    91            done
    92  
    93        # run non-flakes if matrix-id is not 'flakes'
    94        - name: Run e2e tests
    95          # calculate the number of chunks as the number of parallel jobs minus 1 (flakes job)
    96          # use the split tool to split the test suite into chunks and run the chunk corresponding to the matrix-id
    97          # focus on those tests and skip tests marked as FLAKE
    98          run: |
    99            E2E_TEST_NUM_CHUNKS=$(( ${{ strategy.job-total }} - 1 )) \
   100            GINKGO_OPTS="${GINKGO_OPTS} -focus '$(go run ./test/e2e/split/... -chunks $E2E_TEST_NUM_CHUNKS -print-chunk $E2E_TEST_CHUNK ./test/e2e)' -skip '\[FLAKE\]'" \
   101            make e2e;
   102  
   103        # archive test results
   104        - name: Archive Test Artifacts
   105          if: ${{ always() }}
   106          uses: actions/upload-artifact@v4
   107          with:
   108            name: e2e-test-output-${{ (github.event.pull_request.head.sha || github.sha) }}-${{ github.run_id }}-${{ matrix.parallel-id }}
   109            path: ${{ env.ARTIFACT_DIR }}/*
   110          # TODO: create job to combine test artifacts using code in https://github.com/operator-framework/operator-lifecycle-manager/pull/1476
   111  
   112    e2e-tests:
   113      if: ${{ always() }}
   114      runs-on: ubuntu-latest
   115      needs: e2e
   116      steps:
   117      - run: |
   118          echo "Matrix result: ${{ needs.e2e.result }}"
   119      - name: check individual matrix results
   120        if: ${{ needs.e2e.result == 'failure' }}
   121        run: |
   122          echo 'Failure: at least one e2e matrix job has failed'
   123          exit 1
   124  
   125    # Run e2e tests in parallel jobs
   126    # Take olm image from the previous stage
   127    e2e-flakes:
   128      needs: build
   129      strategy:
   130        fail-fast: false
   131      runs-on: ubuntu-latest
   132      env:
   133        # absolute path to test artifacts directory
   134        ARTIFACT_DIR: ${{ github.workspace }}/artifacts
   135        E2E_NODES: 1
   136        E2E_KUBECONFIG_ROOT: ${{ github.workspace }}/kubeconfigs
   137      steps:
   138        # checkout code and setup go
   139        - uses: actions/checkout@v4
   140        - uses: actions/setup-go@v5
   141          with:
   142            go-version-file: "go.mod"
   143  
   144        # load the olm image
   145        - name: Load OLM Docker image
   146          uses: actions/download-artifact@v4
   147          with:
   148            name: olm-image.tar
   149            path: .
   150        - run: docker load < olm-image.tar
   151  
   152        # set e2e environment variables
   153        # Set ginkgo output and parallelism
   154        - run: echo "GINKGO_OPTS=-output-dir ${ARTIFACT_DIR} -junit-report junit_e2e.xml -nodes ${E2E_NODES}" >> $GITHUB_ENV
   155  
   156        # Setting -kubeconfig-root tells the e2e test suite to look for kubeconfigs
   157        # in <kubeconfig-root>/kubeconfig-<node-number>
   158        # This is used to run tests in parallel on multiple clusters as the current e2e
   159        # test suite does not support running tests in parallel on a single cluster
   160        - run: echo "E2E_OPTS=-kubeconfig-root=${E2E_KUBECONFIG_ROOT}" >> $GITHUB_ENV
   161  
   162        # run e2e tests
   163        # create artifacts directory
   164        - run: mkdir -p ${ARTIFACT_DIR}
   165  
   166        # deploy test clusters
   167        - name: Deploy test cluster(s)
   168          # create kubeconfig root and store the kubeconfig for each cluster within it as you create the clusters
   169          # Add kind and helm options to specify kubeconfig location
   170          # Deploy the new cluster and helm install olm for testing
   171          run: |
   172            mkdir -p ${E2E_KUBECONFIG_ROOT}
   173            for i in $(seq 1 ${E2E_NODES}); do
   174              KIND_CLUSTER_NAME="kind-olmv0-${i}" \
   175              KIND_CREATE_OPTS="--kubeconfig=${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}" \
   176              HELM_INSTALL_OPTS="--kubeconfig ${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}" \
   177              make kind-create deploy;
   178            done
   179  
   180        # run e2e tests for flakes if matrix-id is 'flakes'
   181        - name: Run flaky e2e tests
   182          # focus on tests marked as FLAKE
   183          run: |
   184            GINKGO_OPTS="${GINKGO_OPTS} -focus '\[FLAKE\]'" make e2e
   185  
   186        # archive test results
   187        - name: Archive Test Artifacts
   188          if: ${{ always() }}
   189          uses: actions/upload-artifact@v4
   190          with:
   191            name: e2e-test-output-${{ (github.event.pull_request.head.sha || github.sha) }}-${{ github.run_id }}-flakes
   192            path: ${{ env.ARTIFACT_DIR }}/*
   193          # TODO: create job to combine test artifacts using code in https://github.com/operator-framework/operator-lifecycle-manager/pull/1476