10000 CI/CD: Set git SHA explicitely in nerves-preview + Add optional version name input by halimb · Pull Request #642 · evercam/ex_nvr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

CI/CD: Set git SHA explicitely in nerves-preview + Add optional version name input #642

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
Apr 19, 2025

Conversation

halimb
Copy link
Member
@halimb halimb commented Apr 19, 2025

Description

The current version of the nerves-preview workflow has a major flaw (noted by @gBillal ): It always builds and publishes the master branch of ExNVR, which defeats the purpose of the workflow.

After investigation, the root cause is the Github workflow trigger: issue_comment always runs on the main branch of the repo (as a security measure). 1

Changes
This PR fixes the issue by making the workflow:
1- Set an additional output git_sha during the nerves-preview.prepare phase, which was previously fetched from the Github API.
2- Pass git_sha to the nerves reusable workflow as an input (defaults to master)
3- Use it in the actions/checkout step

Other changes
Add an optional version input in the command, to manually specify a version.
e.g.: /build version=<custom version name>

Important note

Testing the workflow in this PR won't work, because of the same Github security restriction mentioned above.
It has to be merged into master first. 1

For validation, I have the same version of the workflow available on this fork https://github.com/halimb/ex_nvr

Footnotes

  1. See: Issue_comment restricted to master: https://github.com/orgs/community/discussions/59389
    See: New workflows must be merged: https://github.com/orgs/community/discussions/25746 2

Copy link

📦 To trigger a firmware build, comment /build below.
To build a specific target, comment /build <target> with on of the following targets
Valid target names:

  • ex_nvr_rpi4
  • ex_nvr_rpi5
  • giraffe

You can also specify a custom version: /build <target> version=<version>
Examples:
/build version=1.0.0-test
/build ex_nvr_rpi5 version=1.0.0-test.123

If no version is specified, one will be generated automatically.

@halimb
Copy link
Member Author
halimb commented Apr 19, 2025

Test runs

1- Successful build

successful
successful-1
successful-2

2- Invalid target

invalid-target

3- invalid version

invalid-version

@gBillal gBillal merged commit cb6ab02 into master Apr 19, 2025
1 check passed
@gBillal gBillal deleted the fix-preview-build-sha branch April 19, 2025 13:20
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.

2 participants
0