Skip to content

CI: Reduce HTTP requests when possible #560

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

Merged
merged 1 commit into from
Feb 11, 2025
Merged

CI: Reduce HTTP requests when possible #560

merged 1 commit into from
Feb 11, 2025

Conversation

jserv
Copy link
Contributor

@jserv jserv commented Feb 9, 2025

Due to frequent CI failures during checksum verification, this commit bypasses integrity checks by assuming all downloaded files are complete, removing the requirement to download and verify checksums.

Summary by Bito

This PR enhances the CI build process by optimizing HTTP requests and file download handling through the introduction of a fetch-releases-tag function. The changes include improved file existence checks to prevent redundant downloads, streamlined build processes with better checksum verification, and enhanced cleanup procedures in the Makefile.

Unit tests added: False

Estimated effort to review (1-5, lower is better): 2

@jserv jserv added this to the release-2025.1 milestone Feb 9, 2025
Copy link

bito-code-review bot commented Feb 9, 2025

Code Review Agent Run #985d6c

Actionable Suggestions - 1
  • mk/artifact.mk - 1
Review Details
  • Files reviewed - 1 · Commit Range: 3aad2be..3aad2be
    • mk/artifact.mk
  • Files skipped - 1
    • .github/workflows/main.yml - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

Copy link

bito-code-review bot commented Feb 9, 2025

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Feature Improvement - Optimized CI Build Process

Makefile - Removed redundant cleanup commands for various data directories

artifact.mk - Implemented new fetch-releases-tag function and optimized download verification process

Copy link

bito-code-review bot commented Feb 9, 2025

Code Review Agent Run #47af7a

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 9ffb959..9ffb959
    • mk/artifact.mk
  • Files skipped - 1
    • .github/workflows/main.yml - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

Copy link

bito-code-review bot commented Feb 9, 2025

Code Review Agent Run #93516d

Actionable Suggestions - 1
  • mk/artifact.mk - 1
    • Consider consolidating duplicate checksum condition checks · Line 80-80
Additional Suggestions - 1
  • mk/artifact.mk - 1
    • Consider simplifying RES variable assignment logic · Line 65-67
Review Details
  • Files reviewed - 1 · Commit Range: 878ce74..878ce74
    • mk/artifact.mk
  • Files skipped - 1
    • .github/workflows/main.yml - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

@jserv jserv requested a review from vacantron February 9, 2025 18:20
@jserv
Copy link
Contributor Author

jserv commented Feb 9, 2025

@vacantron, I tried to bypass checksum validation, but it did not work as intended. Can you help me fix this?

Copy link

bito-code-review bot commented Feb 9, 2025

Code Review Agent Run #b86493

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: ea47f27..ea47f27
    • mk/artifact.mk
  • Files skipped - 1
    • .github/workflows/main.yml - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

@jserv jserv force-pushed the ci-skip-checksum branch 2 times, most recently from 5d017a0 to e260367 Compare February 10, 2025 01:48
Copy link

bito-code-review bot commented Feb 10, 2025

Code Review Agent Run #5e956a

Actionable Suggestions - 2
  • mk/artifact.mk - 2
    • Consider consolidating duplicate checksum condition checks · Line 91-91
    • Consider relocating RES variable reset logic · Line 121-123
Review Details
  • Files reviewed - 1 · Commit Range: e260367..e260367
    • mk/artifact.mk
  • Files skipped - 1
    • .github/workflows/main.yml - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

@jserv jserv requested a review from ChinYikMing February 10, 2025 04:34
@jserv
Copy link
Contributor Author

jserv commented Feb 10, 2025

I defer to @vacantron to determine if we should proceed with the proposed changes.

@jserv jserv changed the title CI: Skip checksum fetching CI: Reduce HTTP requests when possible Feb 10, 2025
Copy link

bito-code-review bot commented Feb 10, 2025

Code Review Agent Run #b1b752

Actionable Suggestions - 2
  • mk/artifact.mk - 2
    • Consider extracting duplicate download logic · Line 40-58
    • Consider piping wget output to tar · Line 118-119
Additional Suggestions - 2
  • mk/artifact.mk - 2
    • Consider consistent makefile indentation style · Line 166-171
    • Consider consistent indentation style in makefile · Line 179-185
Review Details
  • Files reviewed - 2 · Commit Range: 0ec87f3..0ec87f3
    • Makefile
    • mk/artifact.mk
  • Files skipped - 1
    • .github/workflows/main.yml - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

@jserv
Copy link
Contributor Author

jserv commented Feb 10, 2025

Append Close #536 at the end of git commit messages.

@jserv
Copy link
Contributor Author

jserv commented Feb 10, 2025

Mention Arm64 regressions in git commit messages to enable earlier pull request merging despite ongoing CI pipeline issues.

mk/artifact.mk Outdated
Comment on lines 180 to 181
wget -q -O $(BIN_DIR)/sha1sum-linux-x86-softfp $(PREBUILT_BLOB_URL)/sha1sum-linux-x86-softfp
wget -q -O $(BIN_DIR)/sha1sum-riscv32 $(PREBUILT_BLOB_URL)/sha1sum-riscv32
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Later, we may consider to introduce function calls to wrap wget in another pull request.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure. Moreover, consolidating the file name of sha1sum and prebuilts, such as rv32emu-prebuilt-*.sha would make it easier.

run: |
make artifact
make ENABLE_SYSTEM=1 artifact
make ENABLE_ARCH_TEST=1 artifact
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since LATEST_RELEASE is guarded to the tarball, I am not sure if fetching all artifacts in a single job is a good choice.

Would not it make more sense to fetch the required artifact in a relevant job instead? If it is not, the line 242 should be refined such that removing the redundant artifact fetching.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is just moving up the artifacts fetching. We do all userspace test, system simulation test, and architecture test below.

The redundant make artifact could not cause any problem. Beccause once the tarball is downloaded, we check that tarball to decide triggering downloading or not.

Copy link

bito-code-review bot commented Feb 11, 2025

Code Review Agent Run #6bfd95

Actionable Suggestions - 0
Additional Suggestions - 2
  • mk/artifact.mk - 2
Review Details
  • Files reviewed - 2 · Commit Range: c8c8263..c8c8263
    • Makefile
    • mk/artifact.mk
  • Files skipped - 1
    • .github/workflows/main.yml - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

Check prebuilt tarballs are existing or not first. If so, skip the
downloading of releases tags and tarballs.

In the CI, we first call "make artifact" to prepare the tarballs, so the
GitHub API for fetching releases tags would not be called and be skipped
when "make" is called next time.

After this commit, wget in the CI would not complain about error code
403 (rate limit exceeded) anymore. However, the build on Aarch64 still
failed because of other reansons, e.g. software bugs of GCC or QEMU.

Close #536
Copy link

bito-code-review bot commented Feb 11, 2025

Code Review Agent Run #5f64b2

Actionable Suggestions - 1
  • mk/artifact.mk - 1
    • Consider consolidating repeated conditional blocks · Line 185-191
Review Details
  • Files reviewed - 2 · Commit Range: c85279e..c85279e
    • Makefile
    • mk/artifact.mk
  • Files skipped - 1
    • .github/workflows/main.yml - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

AI Code Review powered by Bito Logo

Comment on lines +185 to +191
ifeq ($(wildcard $(BIN_DIR)/rv32emu-prebuilt.tar.gz),)
$(Q)wget -q -O $(BIN_DIR)/sha1sum-linux-x86-softfp $(PREBUILT_BLOB_URL)/sha1sum-linux-x86-softfp
$(Q)wget -q -O $(BIN_DIR)/sha1sum-riscv32 $(PREBUILT_BLOB_URL)/sha1sum-riscv32
$(Q)$(call notice, [OK])
else
$(Q)$(PRINTF) "Skipped\n"
endif

Choose a reason for hiding this comment

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

Consider consolidating repeated conditional blocks

Consider consolidating the conditional block checking for rv32emu-prebuilt.tar.gz with similar patterns found in the code. The same pattern appears multiple times with different file checks which could be refactored into a helper function to improve maintainability.

Code suggestion
Check the AI-generated fix before applying
Suggested change
ifeq ($(wildcard $(BIN_DIR)/rv32emu-prebuilt.tar.gz),)
$(Q)wget -q -O $(BIN_DIR)/sha1sum-linux-x86-softfp $(PREBUILT_BLOB_URL)/sha1sum-linux-x86-softfp
$(Q)wget -q -O $(BIN_DIR)/sha1sum-riscv32 $(PREBUILT_BLOB_URL)/sha1sum-riscv32
$(Q)$(call notice, [OK])
else
$(Q)$(PRINTF) "Skipped\n"
endif
$(call download_if_not_exists,$(BIN_DIR)/rv32emu-prebuilt.tar.gz,$(BIN_DIR)/sha1sum-linux-x86-softfp,$(PREBUILT_BLOB_URL)/sha1sum-linux-x86-softfp)
$(call download_if_not_exists,$(BIN_DIR)/rv32emu-prebuilt.tar.gz,$(BIN_DIR)/sha1sum-riscv32,$(PREBUILT_BLOB_URL)/sha1sum-riscv32)

Code Review Run #5f64b2


Is this a valid issue, or was it incorrectly flagged by the Agent?

  • it was incorrectly flagged

@vacantron
Copy link
Collaborator

The new patch to solve the Arm64 CI failure will be opened after this pull request merged.

https://github.com/sysprog21/rv32emu/actions/runs/13257429033/job/37006598258?pr=560

@jserv jserv merged commit 3c8399e into master Feb 11, 2025
16 of 19 checks passed
@jserv
Copy link
Contributor Author

jserv commented Feb 11, 2025

Thank @vacantron for contributing!

@jserv jserv deleted the ci-skip-checksum branch February 11, 2025 08:54
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.

4 participants