eckit icon indicating copy to clipboard operation
eckit copied to clipboard

Fixes the CI if condition

Open mcakircali opened this issue 8 months ago • 6 comments

mcakircali avatar Mar 26 '25 11:03 mcakircali

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 64.91%. Comparing base (9fac682) to head (addcd8b).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #183   +/-   ##
========================================
  Coverage    64.91%   64.91%           
========================================
  Files         1107     1107           
  Lines        56489    56489           
  Branches      4247     4247           
========================================
  Hits         36669    36669           
  Misses       19820    19820           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Mar 26 '25 11:03 codecov-commenter

Private downstream CI failed. Workflow name: private-downstream-ci View the logs at https://github.com/ecmwf/private-downstream-ci/actions/runs/14083413580.

github-actions[bot] avatar Mar 26 '25 12:03 github-actions[bot]

Private downstream CI failed. Workflow name: private-downstream-ci-hpc View the logs at https://github.com/ecmwf/private-downstream-ci/actions/runs/14085058936.

github-actions[bot] avatar Mar 26 '25 14:03 github-actions[bot]

that's what we have in other downstreams as well.

Just started to wonder about the reason for having success() || failure() ... seems to always happen, or are there other states like skipped() ?

I think it's cancelled. all our repos have it outside the "${{" but not sure which form is correct. or maybe we need !cancelled() .. I don't know

mcakircali avatar Apr 04 '25 09:04 mcakircali

Private downstream CI succeeded. Workflow name: private-downstream-ci View the logs at https://github.com/ecmwf/private-downstream-ci/actions/runs/14263248192.

github-actions[bot] avatar Apr 04 '25 10:04 github-actions[bot]

Private downstream CI succeeded. Workflow name: private-downstream-ci View the logs at https://github.com/ecmwf/private-downstream-ci/actions/runs/14263248192.

github-actions[bot] avatar Apr 04 '25 10:04 github-actions[bot]

@mcakircali Do you want to pick this up again or should I close it?

Ozaq avatar Jun 24 '25 17:06 Ozaq

The change is not correct as far as I can see: inside the conditional you can either use literals or expressions not mixed.

can you attach a reference for that statement?

also, have you looked at our other repos and compare?

I believe there was an issue in the past that lead to fix (see our other repos), it's best to ask Jakub or Dusan to review it.

mcakircali avatar Jun 25 '25 06:06 mcakircali

@mcakircali If you look at: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif

It is stated that ${{ }} can be omitted in this case because the whole condition will be evaluated as expression.

See the respective discussion here: https://github.com/orgs/community/discussions/27152

No ${{ ... }} at all should work, too. But using it for parts of the if value will always create a non-empty string, which is always true.

Ozaq avatar Jun 25 '25 09:06 Ozaq

While this works I can understand it might be confusing. It is technically possible to omit ${{ }} syntax but mixing it would not be my recommendation - it is not explicitly mentioned in GitHub docs but it would make it consistent.

The mixed syntax is currently being used in multiple ECMWF repos so I suggest to update those too along with the documentation.

as I mentioned in previous comment, previously we did not have the mixed syntax in our repos. The mixed syntax came as a fix from Dusan (I believe), hence I created this PR in eckit because it was not same as other repos.

I committed your suggestion to this PR (which also fixes the scope) and if it works, we can merge this and align other repos too, so that they are also not mixed syntax.

mcakircali avatar Jun 25 '25 09:06 mcakircali

This does not yet address the issue fully. The private and non-private downstream jobs are not running for PRs from forks.

Looking at the other conditions: private-downstream depends on downstream but downstream is never run for forks, and is thus skipped. The depending job for private-downstream will never run because success() || failure() id fall if downstream is skipped.

Ozaq avatar Jun 25 '25 11:06 Ozaq

This does not yet address the issue fully. The private and non-private downstream jobs are not running for PRs from forks.

Looking at the other conditions: private-downstream depends on downstream but downstream is never run for forks, and is thus skipped. The depending job for private-downstream will never run because success() || failure() id fall if downstream is skipped.

Yes you are right, the fix should be applied to dowstream-ci too (as correctly presented in docs).

https://github.com/ecmwf/eckit/blob/59a51fc8573bd035aa4bc8c27d084aeb594670e4/.github/workflows/ci.yml#L26 https://github.com/ecmwf/eckit/blob/59a51fc8573bd035aa4bc8c27d084aeb594670e4/.github/workflows/ci.yml#L57 ->

${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }}

recmanj avatar Jun 25 '25 11:06 recmanj

FYI, (don't ask me why) but I see that the tag is removed by bot:

image

mcakircali avatar Jun 25 '25 11:06 mcakircali

Private downstream CI failed. Workflow name: private-downstream-ci-hpc View the logs at https://github.com/ecmwf/private-downstream-ci/actions/runs/15876941752.

github-actions[bot] avatar Jun 25 '25 13:06 github-actions[bot]