New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend catalog test script to run tests for different platforms #797
Conversation
/test pull-tekton-catalog-integration-tests |
1 similar comment
/test pull-tekton-catalog-integration-tests |
fe91c3c
to
d3fb363
Compare
/test pull-tekton-catalog-integration-tests |
test/e2e-common.sh
Outdated
set -o allexport | ||
source $(dirname $0)/$(echo ${PLATFORM}| tr / -).envs | ||
set +o allexport | ||
# Install yq | ||
echo "Getting yq" | ||
wget https://github.com/mikefarah/yq/releases/download/v4.11.2/yq_linux_amd64 | ||
chmod +x yq_linux_amd64 | ||
mv yq_linux_amd64 /bin/yq | ||
# Add MAVEN_IMAGE parameter to the appropriate maven tests | ||
echo "Add extra MAVEN_IMAGE parameter" | ||
find task/*maven*/*/tests/run.yaml | xargs -I{} yq eval '(..|select(.kind?=="Pipeline")|select(.metadata.name?=="jib-maven-test-pipeline"|"maven-test-pipeline")|.spec.tasks[1].params) |= . +{"name": "MAVEN_IMAGE","value": env(MAVEN_IMAGE)}' -i {} | ||
# Replace registry image to platform specific | ||
echo "Change registry image value" | ||
find task -name *registry*.yaml | xargs -I{} yq eval '(..|select(.kind?=="Deployment")|select(.metadata.name?=="registry")|.spec.template.spec.containers[0].image)|= env(REGISTRY_IMAGE)' -i {} | ||
# change GOARCH parameter value to the platform specific one for golang-* tasks | ||
echo "Change GOARCH parameter value" | ||
find task/golang*/*/tests/run.yaml | xargs -I{} yq eval '(..|select(.kind?=="Pipeline")|.spec.tasks[1].params) |= . +{"name": "GOARCH","value": env(GOARCH)}' -i {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of having platform specific env to being able to manipulate the task on demand but this seems a bit too specific and I am not sure if that would be scalable.
what about if those commands are just platform specifics, where basically moving all those lines to the .env file, so it only applies to the s390x platform ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, interesting idea. I had in mind that the same modification will be required for other platforms (just because, I participated in test work also for Power, for example), but yeah, may be extra bash scripts, specific for each platform is even better and will provide much more flexibility. Thank you for idea, will work in it!
Just to make sure we are on the same page, you are ok regarding using yq
tool for modifications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah no worries! we just need to make sure it's in the base image!
(tbh: we should rework all of this e2e test suite in a python or golang but another fight for another day i guess)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we just need to make sure it's in the base image!
At this moment it is installed in the script ) I've just copied approach, which dashboard component has..
Let me check if I can add it to test-runner
image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chmouel yq is added to the test-runner image - tektoncd/plumbing#909
Could you please review this PR one more time?
d3fb363
to
9624c2e
Compare
9624c2e
to
47d92f2
Compare
47d92f2
to
b6617eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so far so good thanks, i have added some minor comments
|
||
# Do the tasks modifications if special PLATFORM value is specified. By default nothing happens. | ||
if [[ -n ${PLATFORM} ]] && [[ -f "$(dirname $0)/$(echo ${PLATFORM}| tr / -).sh" ]]; then | ||
# Load script specific to platform. File name should follow the pattern "os-arch.sh", for instance "linux-s390x.sh". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
test/e2e-common.sh
Outdated
@@ -166,6 +175,10 @@ function test_yaml_can_install() { | |||
for ignore in ${TEST_YAML_IGNORES};do | |||
[[ ${ignore} == "${testname}" ]] && skipit=True | |||
done | |||
|
|||
# In case if PLATFORM env variable is specified, do the tests only for matching tasks | |||
[[ -n ${PLATFORM} ]] && [[ $(grep "tekton.dev/platforms" ${runtest}) != *"${PLATFORM}"* ]] && skipit=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe redirect stderr to /dev/null since it may fails (but the case is handled in skipit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chmouel done
PLATFORM env variable is introduced. This variable allows to run tests for specific platform (for insance, "linux/s390x" or "linux/ppc64le"). If the environment variable is specified - some tests are updated with different image values/other parameter values, required for specific platform, using yq tool. Custom values should be specified in the script file, separate for each platform. In the current code script file for linux/s390x is proposed. - only tasks, which have mention about corresponding platform support in the annotation, will be tested. If PLATFORM env variale is no specified, the behaviour of test scripts will be similar to the one before the PR. Signed-off-by: Yulia Gaponenko <yulia.gaponenko1@de.ibm.com>
b6617eb
to
c648281
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vinamra28 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Changes
PLATFORM env variable is introduced. This variable allows to run tests for specific platform (for instance, "linux/s390x" or "linux/ppc64le").
If the environment variable is specified:
Image names should be specified in script file, separate for each platform. In the current code script file for linux/s390x is proposed.
If PLATFORM env variable is not specified, the behaviour of test scripts will be similar to the one before the PR.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
File path follows
<kind>/<name>/<version>/name.yaml
Has
README.md
at<kind>/<name>/<version>/README.md
Has mandatory
metadata.labels
-app.kubernetes.io/version
the same as the<version>
of the resourceHas mandatory
metadata.annotations
tekton.dev/pipelines.minVersion
mandatory
spec.description
follows the conventionSee the contribution guide
for more details.