Skip to content

Commit

Permalink
Change integration img base image (#5004)
Browse files Browse the repository at this point in the history
* Bump up integration img

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>

* wip update integration base img

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>

* Rename executor to e2e-runner

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>

* Change container image

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>

* Rename integration to e2e-runner

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>

* Fix pod selector

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
  • Loading branch information
antgamdia authored Jul 8, 2022
1 parent 4ec1c41 commit 338632b
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 126 deletions.
6 changes: 4 additions & 2 deletions integration/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2020-2022 the Kubeapps contributors.
# SPDX-License-Identifier: Apache-2.0

use-cases/*js
.git
reports/screenshots/**/*
node_modules/
tests/**/*
reports/**/*
reports-html/**/*
23 changes: 12 additions & 11 deletions integration/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Copyright 2019-2022 the Kubeapps contributors.
# SPDX-License-Identifier: Apache-2.0

# Dependencies taken from https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
# TODO(agamez): this is the latest version based upon debian-10.
# see: https://github.com/vmware-tanzu/kubeapps/issues/4206#issuecomment-1152374865
FROM bitnami/node:16.15.0-debian-10-r5
RUN install_packages ca-certificates fonts-liberation gconf-service libappindicator1 libappindicator3-1 libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libdrm2 libexpat1 libfontconfig1 libgbm1 libgbm-dev libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libice6 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libsm6 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils libxshmfence-dev
ADD . /app/
# Make sure we don't ship the current tests with the image
# Renaming or relocating tests might mess things up otherwise
RUN rm -rf /app/tests
RUN yarn install
CMD [ "yarn", "start" ]
FROM mcr.microsoft.com/playwright:v1.23.0-focal
WORKDIR /app/

# Copy and install deps
COPY package.json yarn.lock /app/
RUN yarn install --frozen-lockfile

# Install browsers
RUN npx playwright install

# Note that the playwright config and the actual test files
# will be later passed via kubectl cp in runtime
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: integration
name: integration
run: e2e-runner
name: e2e-runner
spec:
selector:
matchLabels:
run: integration
run: e2e-runner
template:
metadata:
labels:
run: integration
run: e2e-runner
spec:
containers:
- args:
- tail
- -f
- /dev/null
image: kubeapps/integration-tests:v1.1.1
image: kubeapps/integration-tests:v2.0.0
name: integration
# TODO (castelblanque) Adjust properly the resources.
# Current values are not empirically demonstrated.
Expand Down
8 changes: 3 additions & 5 deletions integration/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kubeapps-integration",
"license": "Apache-2.0",
"version": "1.1.1",
"version": "2.0.0",
"description": "Kubeapps integration tests",
"main": "index.js",
"private": true,
Expand All @@ -10,12 +10,10 @@
"test": "playwright test --workers=1"
},
"dependencies": {
"axios": "^0.27.2",
"playwright": "^1.23.2",
"wait-on": "^6.0.1"
"@playwright/test": "^1.23.2",
"axios": "^0.27.2"
},
"devDependencies": {
"@playwright/test": "^1.23.2",
"prettier": "^2.7.1"
}
}
95 changes: 4 additions & 91 deletions integration/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
# yarn lockfile v1


"@hapi/hoek@^9.0.0":
version "9.3.0"
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"
integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==

"@hapi/topo@^5.0.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012"
integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==
dependencies:
"@hapi/hoek" "^9.0.0"

"@playwright/test@^1.23.2":
version "1.23.2"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.23.2.tgz#6af9e77bafcfe6dd17c23a44b40f793db5245d74"
Expand All @@ -22,40 +10,16 @@
"@types/node" "*"
playwright-core "1.23.2"

"@sideway/address@^4.1.3":
version "4.1.4"
resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.4.tgz#03dccebc6ea47fdc226f7d3d1ad512955d4783f0"
integrity sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==
dependencies:
"@hapi/hoek" "^9.0.0"

"@sideway/formula@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.0.tgz#fe158aee32e6bd5de85044be615bc08478a0a13c"
integrity sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==

"@sideway/pinpoint@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df"
integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==

"@types/node@*":
version "17.0.41"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.41.tgz#1607b2fd3da014ae5d4d1b31bc792a39348dfb9b"
integrity sha512-xA6drNNeqb5YyV5fO3OAEsnXLfO7uF0whiOfPTz5AeDo8KeZFmODKnvwPymMNO8qE/an8pVY/O50tig2SQCrGw==
version "18.0.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.3.tgz#463fc47f13ec0688a33aec75d078a0541a447199"
integrity sha512-HzNRZtp4eepNitP+BD6k2L6DROIDG4Q0fm4x+dwfsr6LGmROENnok75VGw40628xf+iR24WeMFcHuuBDUAzzsQ==

asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==

axios@^0.25.0:
version "0.25.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.25.0.tgz#349cfbb31331a9b4453190791760a8d35b093e0a"
integrity sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==
dependencies:
follow-redirects "^1.14.7"

axios@^0.27.2:
version "0.27.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972"
Expand All @@ -76,7 +40,7 @@ delayed-stream@~1.0.0:
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==

follow-redirects@^1.14.7, follow-redirects@^1.14.9:
follow-redirects@^1.14.9:
version "1.15.1"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5"
integrity sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==
Expand All @@ -90,22 +54,6 @@ form-data@^4.0.0:
combined-stream "^1.0.8"
mime-types "^2.1.12"

joi@^17.6.0:
version "17.6.0"
resolved "https://registry.yarnpkg.com/joi/-/joi-17.6.0.tgz#0bb54f2f006c09a96e75ce687957bd04290054b2"
integrity sha512-OX5dG6DTbcr/kbMFj0KGYxuew69HPcAE3K/sZpEV2nP6e/j/C0HV+HNiBPCASxdx5T7DMoa0s8UeHWMnb6n2zw==
dependencies:
"@hapi/hoek" "^9.0.0"
"@hapi/topo" "^5.0.0"
"@sideway/address" "^4.1.3"
"@sideway/formula" "^3.0.0"
"@sideway/pinpoint" "^2.0.0"

lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

mime-db@1.52.0:
version "1.52.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
Expand All @@ -118,47 +66,12 @@ mime-types@^2.1.12:
dependencies:
mime-db "1.52.0"

minimist@^1.2.5:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==

playwright-core@1.23.2:
version "1.23.2"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.23.2.tgz#ddc15b3251e42ee0eed82a96ece3f7b2641d75a4"
integrity sha512-UGbutIr0nBALDHWW/HcXfyK6ZdmefC99Moo4qyTr89VNIkYZuDrW8Sw554FyFUamcFSdKOgDPk6ECSkofGIZjQ==

playwright@^1.23.2:
version "1.23.2"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.23.2.tgz#379eccbaed58ba23152d02934b4bc5104b4b7e60"
integrity sha512-c7nyyuDRifGBUNb+/zZh4AjyQXQISVHZY2cpHCsSIWueZNtY7q6Qfv0hJbVdtJhWSGgcix0hmES30l5jlPmy5Q==
dependencies:
playwright-core "1.23.2"

prettier@^2.7.1:
version "2.7.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64"
integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==

rxjs@^7.5.4:
version "7.5.5"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.5.tgz#2ebad89af0f560f460ad5cc4213219e1f7dd4e9f"
integrity sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw==
dependencies:
tslib "^2.1.0"

tslib@^2.1.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==

wait-on@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-6.0.1.tgz#16bbc4d1e4ebdd41c5b4e63a2e16dbd1f4e5601e"
integrity sha512-zht+KASY3usTY5u2LgaNqn/Cd8MukxLGjdcZxT2ns5QzDmTFc4XoWBgC+C/na+sMRZTuVygQoMYwdcVjHnYIVw==
dependencies:
axios "^0.25.0"
joi "^17.6.0"
lodash "^4.17.21"
minimist "^1.2.5"
rxjs "^7.5.4"
8 changes: 4 additions & 4 deletions script/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ done

# Browser tests
cd "${ROOT_DIR}/integration"
kubectl apply -f manifests/executor.yaml
k8s_wait_for_deployment default integration
pod=$(kubectl get po -l run=integration -o jsonpath="{.items[0].metadata.name}")
kubectl apply -f manifests/e2e-runner.yaml
k8s_wait_for_deployment default e2e-runner
pod=$(kubectl get po -l run=e2e-runner -o jsonpath="{.items[0].metadata.name}")
## Copy config and latest tests
for f in *.js; do
kubectl cp "./${f}" "${pod}:/app/"
Expand All @@ -394,7 +394,7 @@ fi
testsArgs="$(printf "%s " "${testsToRun[@]}")"

kubectl cp ./tests "${pod}:/app/"
info "Copied tests to integration pod ${pod}"
info "Copied tests to e2e-runner pod ${pod}"
## Create admin user
kubectl create serviceaccount kubeapps-operator -n kubeapps
kubectl create clusterrolebinding kubeapps-operator-admin --clusterrole=cluster-admin --serviceaccount kubeapps:kubeapps-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ cd integration
yarn upgrade
```

- The [integration/Dockerfile](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/Dockerfile) uses a [bitnami/node](https://hub.docker.com/r/bitnami/node/tags) image for running the e2e tests.
- The [integration/Dockerfile](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/Dockerfile) uses a [mcr.microsoft.com/playwright](https://mcr.microsoft.com/v2/playwright/tags/list) image for running the e2e tests.

> As part of this release process, this Node image tag _may_ be updated to the latest minor/patch version. In case of a major version, the change _should_ be tracked in a separate PR. Analogously, its dependencies _may_ also be updated, but in case of a major change, it _should_ be tracked in a separate PR.
> **Note**: this image is not being built automatically. Consequently, a [manual build process](../testing/end-to-end-tests.md#building-the-kubeappsintegration-tests-image) _must_ be triggered if you happen to upgrade the integration image or its dependencies.
Expand Down
14 changes: 7 additions & 7 deletions site/content/docs/latest/reference/testing/end-to-end-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ To run the tests locally you just need to install the required dependencies and
```bash
cd integration
yarn install
INTEGRATION_ENTRYPOINT=http://kubeapps.local USE_MULTICLUSTER_OIDC_ENV=false ADMIN_TOKEN=foo1 VIEW_TOKEN=foo2 EDIT_TOKEN=foo3 yarn start
INTEGRATION_ENTRYPOINT=http://kubeapps.local USE_MULTICLUSTER_OIDC_ENV=false ADMIN_TOKEN=foo1 VIEW_TOKEN=foo2 EDIT_TOKEN=foo3 yarn test

```

Expand All @@ -52,15 +52,15 @@ Since the CI environment doesn't have the required dependencies and to provide a

To do so, you can spin up an instance running the image [kubeapps/integration-tests](https://hub.docker.com/r/kubeapps/integration-tests).
This image contains all the required dependencies and it waits forever so you can run commands within it.
We also provide a simple [Kubernetes Deployment manifest](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/manifests/executor.yaml) for launching this container.
We also provide a simple [Kubernetes Deployment manifest](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/manifests/e2e-runner.yaml) for launching this container.

The goal of this setup is that you can copy the latest tests to the image, run the tests and extract the screenshots in case of failure:

```bash
cd integration

# Deploy the executor pod
kubectl apply -f manifests/executor.yaml
# Deploy the e2e-runner pod
kubectl apply -f manifests/e2e-runner.yaml
pod=$(kubectl get po -l run=integration -o jsonpath="{.items[0].metadata.name}")

# Copy latest tests
Expand All @@ -71,7 +71,7 @@ kubectl cp ./tests ${pod}:/app/


# Run tests (you must fill these vars accordingly)
kubectl exec -it ${pod} -- /bin/sh -c "INTEGRATION_ENTRYPOINT=http://kubeapps.kubeapps USE_MULTICLUSTER_OIDC_ENV=${USE_MULTICLUSTER_OIDC_ENV} ADMIN_TOKEN=${admin_token} VIEW_TOKEN=${view_token} EDIT_TOKEN=${edit_token} yarn start"
kubectl exec -it ${pod} -- /bin/sh -c "INTEGRATION_ENTRYPOINT=http://kubeapps.kubeapps USE_MULTICLUSTER_OIDC_ENV=${USE_MULTICLUSTER_OIDC_ENV} ADMIN_TOKEN=${admin_token} VIEW_TOKEN=${view_token} EDIT_TOKEN=${edit_token} yarn test"

# If the tests fail, get report screenshot
kubectl cp ${pod}:/app/reports ./reports
Expand All @@ -96,12 +96,12 @@ IMAGE_TAG=v1.0.1 make push
When pushing a new image, also update the field `version` in the [package.json](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/package.json).

Then, update the [Kubernetes Deployment manifest](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/manifests/executor.yaml) to point to the version you have built and pushed.
Then, update the [Kubernetes Deployment manifest](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/manifests/e2e-runner.yaml) to point to the version you have built and pushed.

To sum up, whenever a change triggers a new `kubeapps/integration-tests` version (new NodeJS image, updating the integration dependencies, other changes, etc.), you will have to release a new version. This process involves:

- Checking if the [integration Dockerfile](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/Dockerfile) is using the proper base version.
- Ensuring we are not using any deprecated dependency in the [package.json](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/package.json).
- Updating the [Makefile](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/Makefile) with the new version tag.
- running `make build && make push` to release a new image version.
- Modifying the [Kubernetes Deployment manifest](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/manifests/executor.yaml) with the new version.
- Modifying the [Kubernetes Deployment manifest](https://github.com/vmware-tanzu/kubeapps/blob/main/integration/manifests/e2e-runner.yaml) with the new version.

0 comments on commit 338632b

Please sign in to comment.