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

chore(ci): use ec2 for build-and-test-differential #4413

Merged
merged 10 commits into from
Jul 31, 2023
Merged

chore(ci): use ec2 for build-and-test-differential #4413

merged 10 commits into from
Jul 31, 2023

Conversation

xmfcx
Copy link
Contributor

@xmfcx xmfcx commented Jul 26, 2023

Description

How it works

There are 5 consequent jobs:

  • prevent-no-label-execution
  • start-runner
  • build-and-test-differential
  • clang-tidy-differential
  • stop-runner

The way it works is,

1. prevent-no-label-execution

This job checks if PR has prevent-no-label-execution tag. If yes, it can continue. If not, workflow stops.

2. start-runner

  1. This job spawns a machine in EC2.
  2. This job then registers this runner to the autowarefoundation/autoware.universe/runners using my personal Github token (which is a secret).
    • This runner is assigned a special label.
      • Example runner labels: self-hosted, Linux, X64, o837y (last one being unique)
  3. This action takes about 1m40s to complete. This delay comes mostly from EC2 instantiating the machine.
  • I've set the machine to be a c6a.xlarge instance which is a good match for running generic build and test jobs. The machine has 4 vCPU, 8 GiB Memory, 50GB SSD storage. (Powered by 3rd generation AMD EPYC processors)
    • We can reduce it to a less powerful machine based on testing the performance and the cost.

3. build-and-test-differential

  • This is 1st the 2 actual jobs we are attempting to run.
  • It runs specifically on the runners with the unique label that was assigned in the previous job.
    • Example label: o837y

4. clang-tidy-differential

  • This is 2nd the 2 actual jobs we are attempting to run.
  • This is dependent on the success of the previous job (build-and-test-differential)
  • It runs specifically on the runners with the unique label that was assigned in the previous job.
    • Example label: o837y

5. stop-runner

  • Regardless of the success or failure of the previous jobs, this job terminates the instance that was created in the first run.
  • The runner is also removed from autowarefoundation/autoware.universe/runners using the unique label that had been assigned.

Summary

  • With this PR merged, there will be as many runners as we have these jobs.
    • People won't have to wait for a over-burdened runner to pick up their job.

Tests performed

Job is successful: https://github.com/autowarefoundation/autoware.universe/actions/runs/5716141354/job/15487030009?pr=4413

Effects on system behavior

Not applicable.

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.

After all checkboxes are checked, anyone who has write access can merge the PR.

@github-actions github-actions bot added the type:ci Continuous Integration (CI) processes and testing. (auto-assigned) label Jul 26, 2023
@xmfcx xmfcx added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jul 26, 2023
M. Fatih Cırıt and others added 3 commits July 31, 2023 14:20
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
M. Fatih Cırıt added 6 commits July 31, 2023 14:38
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
@xmfcx xmfcx requested a review from mitsudome-r July 31, 2023 13:48
@xmfcx xmfcx marked this pull request as ready for review July 31, 2023 13:48
@xmfcx xmfcx self-assigned this Jul 31, 2023
@xmfcx xmfcx requested a review from shmpwk July 31, 2023 14:27
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
@xmfcx
Copy link
Contributor Author

xmfcx commented Jul 31, 2023

I've added a detailed description to the first post.

@xmfcx
Copy link
Contributor Author

xmfcx commented Jul 31, 2023

After this is merged, I will probably remove this workflow from the sync-files job until we decide to increase its scope.
https://github.com/autowarefoundation/autoware.universe/blob/main/.github/sync-files.yaml#L46-L58

Related PR: #4372 (comment)

@shmpwk
Copy link
Contributor

shmpwk commented Jul 31, 2023

Fixed spell check failure in tier4/autoware-spell-check-dict#593.

Copy link
Contributor

@shmpwk shmpwk left a comment

Choose a reason for hiding this comment

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

LGTM!!!

@xmfcx xmfcx merged commit 862830d into main Jul 31, 2023
@xmfcx xmfcx deleted the chore/use-ec2 branch July 31, 2023 16:01
@xmfcx
Copy link
Contributor Author

xmfcx commented Jul 31, 2023

https://github.com/autowarefoundation/autoware.universe/actions/runs/5716984310/job/15489764848?pr=4458

:( It cannot see the secret, now investigating it.

@xmfcx
Copy link
Contributor Author

xmfcx commented Jul 31, 2023

https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks#about-workflow-runs-from-public-forks

Workflows from forks do not have access to sensitive data such as secrets.

https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow

With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository.


I think this whole plan won't work. I will revert this change and add the machine for perpetual running.


More info on why it was a bad idea: GitHub Actions requiring secrets on a fork-origin PR

xmfcx added a commit that referenced this pull request Jul 31, 2023
xmfcx added a commit that referenced this pull request Jul 31, 2023
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
xmfcx added a commit that referenced this pull request Jul 31, 2023
kminoda pushed a commit to kminoda/autoware.universe that referenced this pull request Aug 1, 2023
kminoda pushed a commit to kminoda/autoware.universe that referenced this pull request Aug 1, 2023
@shmpwk
Copy link
Contributor

shmpwk commented Aug 1, 2023

@xmfcx How about using GitHub hosted larger runner? Maybe is it out of your budget?

@mitsudome-r
Copy link
Member

mitsudome-r commented Aug 1, 2023

@shmpwk In order to use larger GitHub hosted runners, we have to register the organization as either GitHub Team plan or GitHub Enterprise plan as explained here. However, if we upgrade AutowareFoundation's plan, then we have to pay at least $3.67 per user/month. We currently have 173 members added to the organization so that would be extra cost of about $7,600 per year.

@xmfcx
Copy link
Contributor Author

xmfcx commented Aug 1, 2023

@shmpwk in addition to Github Team pricing, c6a.xlarge instance costs $0.153 per hour.

For a month,
$0.153 per hour * 24 hours/day * 30 days/month = $0.153 * 24 * 30 = $110.16
it costs this much.
If the budget was $960 per month, I would prefer having 8 of these self hosted machines.

felixf4xu pushed a commit to felixf4xu/autoware.universe that referenced this pull request Aug 2, 2023
…n#4413)

Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
Signed-off-by: Felix F Xu <felixfxu@gmail.com>
felixf4xu pushed a commit to felixf4xu/autoware.universe that referenced this pull request Aug 2, 2023
…oundation#4413)" (autowarefoundation#4477)

Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
Signed-off-by: Felix F Xu <felixfxu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) type:ci Continuous Integration (CI) processes and testing. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants