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

Add runs-on field to Spotless Check step in CI #3400

Merged

Conversation

rithin-pullela-aws
Copy link
Contributor

Description

Without the runs-on field, the spotless check step fails

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@dhrubo-os dhrubo-os merged commit 48379ad into opensearch-project:main Jan 16, 2025
5 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 16, 2025
Signed-off-by: rithin-pullela-aws <[email protected]>
(cherry picked from commit 48379ad)
dhrubo-os pushed a commit that referenced this pull request Jan 16, 2025
Signed-off-by: rithin-pullela-aws <[email protected]>
(cherry picked from commit 48379ad)

Co-authored-by: Rithin Pullela <[email protected]>
@@ -23,6 +23,8 @@ jobs:
product: opensearch

spotless:
if: github.repository == 'opensearch-project/ml-commons'
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats the significance of using if here?

I'm not too familiar with the CI workflow but cant we make it always run the latest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This if condition forces the job (specifically the spotless step) to only run, if triggered in ml-commons repo. Essentially preventing it to run in any other repository.

For example in line 20 we have this:

    uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
    with:
      product: opensearch

We are triggering a workflow file from opensearch-build team.
Had the openserach-build team put a condition in their workflow file to only run if the repo is opensearch-build, the Get-CI-Image-Tag step in our CI would have failed.

Having this check prevents accidental or unintended execution. (It does not effect the logic, just a good practice)

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants