Skip to content
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

Update action version to 4 #33

Merged
merged 2 commits into from
Feb 12, 2024
Merged

Conversation

b10n1k
Copy link
Contributor

@b10n1k b10n1k commented Feb 9, 2024

No description provided.

@b10n1k b10n1k requested review from baierjan and okurz February 9, 2024 09:11

- name: fail if any test module failed
run: jq .result testresults/result-*.json | grep -v ok && echo "Test modules failed" && exit 1
run: jq .result testresults/result-*.json | grep ok || (echo "Test modules failed" && exit 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider #31 (comment)

Suggested change
run: jq .result testresults/result-*.json | grep ok || (echo "Test modules failed" && exit 1)
run: jq .result testresults/result-*.json | grep -v ok && { echo "Test modules failed" && exit 1; } || true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #33 (comment)

Comment on lines 20 to 21
&& jq .result testresults/result-*.json | grep ok \
|| (echo "Test modules failed" && exit 1)'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same grep and subshell problem as above,

Suggested change
&& jq .result testresults/result-*.json | grep ok \
|| (echo "Test modules failed" && exit 1)'
&& jq .result testresults/result-*.json | grep -v ok \
&& { echo "Test modules failed" && exit 1; } || true'

@@ -13,4 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Run isotovideo against test code, fail if any test module failed
run: podman run --rm -it -v .:/tests:Z --entrypoint '' registry.opensuse.org/devel/openqa/containers/isotovideo:qemu-x86-jq /bin/sh -c 'isotovideo qemu_no_kvm=1 casedir=/tests && jq .result testresults/result-*.json | grep -v ok && echo "Test modules failed" && exit 1'
run: |
docker run --rm -v .:/tests:Z --entrypoint '' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider #31 (comment)

Is the switch from podman to docker intended? I thought podman is the preferred way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman is not provided in the container. I found it easier to just switch to docker. i am not sure if that matters here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also saw that we still run ubuntu-20.04 here, created

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whops, I will close #35 in favor of yours, it seems we observed the same. 😄


- name: Run isotovideo against test code
run: isotovideo qemu_no_kvm=1 casedir=.
run: isotovideo qemu_no_kvm=1 casedir=$(pwd)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not keep .?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a significant reason. personal preference. it s quite similar

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then please revert


- name: fail if any test module failed
run: jq .result testresults/result-*.json | grep -v ok && echo "Test modules failed" && exit 1
run: jq .result testresults/result-*.json | grep ok || (echo "Test modules failed" && exit 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that grep ok would just mean that there is at least one test module that failed. But the purpose was to fail if any module fails. As we expect the execution in the example to fail what we can do is

Suggested change
run: jq .result testresults/result-*.json | grep ok || (echo "Test modules failed" && exit 1)
run: jq .result testresults/result-*.json | grep -v ok && (echo "At least one test module failed as expected" && exit 0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i applied suggestion from @baierjan. review and resolve please

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I saw that you applied the suggestion from @baierjan. The problem is that this way we are ignoring results either way. But we should check for the expected result which is actually that test modules should fail which serves as the example

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you suggest that it is expected that the test will fail (i.e. the result of the isotovideo is no ok)? Running the pipeline locally yields testresults/result-boot.json with the "result" : "ok", so the original code

run: jq .result testresults/result-*.json | grep -v ok && echo "Test modules failed" && exit 1

only fails the pipeline because of the empty match from grep (i.e. after removing all ok results, there is no other record).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, you are right. That changed in a pull request from @Martchus some months ago. Then it should be

run: jq .result testresults/result-*.json | grep -v ok || (echo "Test modules failed" && exit 1)

right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe not. The success of grep -v ok means something else than ok was matched (and that should be a failure); on the other hand, if grep -v ok fails (with exit code 1, btw.) it means there is no other result than ok, so it is actually a success.
So what we want to have is

if $(jq .result testresults/result-*.json | grep -v ok); then echo "Test modules failed"; exit 1; else exit 0; fi

My original suggestion jq .result testresults/result-*.json | grep -v ok && { echo "Test modules failed" && exit 1; } || true should be the same. The "only" issue here is, that it masks error in jq. If we want to solve that, we need to introduce a little more logic.

Maybe

test $(jq .result testresults/result-*.json | grep -v ok | wc -l) -eq 0 || { echo "Test modules failed"; exit 1; }

could be more readable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an even better idea as @josegomezr already fixed that use case for us :) -> #36

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is the perfect solution.

registry.opensuse.org/devel/openqa/containers/isotovideo:qemu-x86-jq /bin/sh \
-c 'isotovideo qemu_no_kvm=1 casedir=/tests \
&& jq .result testresults/result-*.json | grep ok \
|| (echo "Test modules failed" && exit 1)'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i applied suggestion from @baierjan. review and resolve please

run: podman run --rm -it -v .:/tests:Z registry.opensuse.org/devel/openqa/containers/isotovideo:qemu-x86 qemu_no_kvm=1 casedir=/tests
run: docker run --rm -v .:/tests:Z registry.opensuse.org/devel/openqa/containers/isotovideo:qemu-x86 qemu_no_kvm=1 casedir=/tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you change that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman is not provided in the container. I found it easier to just switch to docker.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which container? The ubuntu-latest provided by Github includes podman version 3.4.4 (see https://github.com/baierjan/actions-experiments/actions/runs/7842150230/job/21399883954)

@@ -13,4 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#31 (comment)

Can you also change the action to actions/checkout@v4?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. i was thinking about that. I just do not know where to find the latest version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

baierjan added a commit that referenced this pull request Feb 9, 2024
While reviewing #33 I found out that the comment about latest images is
no longer relevant and in fact the latest image is now pointing to
version 22.04. Let's remove the override and get back to latest image.
Copy link
Member

@baierjan baierjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we want to rebase over #36 and see what is left here.

@b10n1k
Copy link
Contributor Author

b10n1k commented Feb 9, 2024

I believe we want to rebase over #36 and see what is left here.

Do we even need it anymore?

@okurz
Copy link
Member

okurz commented Feb 10, 2024

@b10n1k I incorporated your great ideas to fix the CI jobs but at least c3ab292 would be beneficial on top

@baierjan
Copy link
Member

@b10n1k I incorporated your great ideas to fix the CI jobs but at least c3ab292 would be beneficial on top

Yes, also the action version change to mitigate the node.js deprecation warning would be nice.

Copy link
Member

@baierjan baierjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a minor issue, the commit message now does not correspond with the changes inside the commit; otherwise LGTM

Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, "8428444" shouldn't say that it would fix isotovideo CI jobs

Signed-off-by: ybonatakis <[email protected]>
Due to isotovideo:qemu-x86-jq the step which installs jq is not needed.

Signed-off-by: ybonatakis <[email protected]>
@b10n1k b10n1k changed the title Fix isotovideo CI jobs Update action version to 4 Feb 12, 2024
@okurz okurz merged commit d2c0b08 into os-autoinst:main Feb 12, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants