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
[ci] only checkout with tags for non-tag runs #2017
Conversation
OK so i don't want to commit a tag that looks like a version without asking first because that might trigger some unwanted deploy, but i do need to push a tag in order to trigger the bug. so i made a temporary tag it introduces another problem, presumably because the tag name no longer is a semver, and that metadata extraction step looks like it needs the tag to be. that should not happen in the normal conditions that this action would be run in, but again i don't want to test that by myself rn. So I am reverting the changes here that were needed to trigger the tag build outside of |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2017 +/- ##
==========================================
- Coverage 80.70% 80.69% -0.02%
==========================================
Files 104 104
Lines 11620 11622 +2
Branches 2909 2910 +1
==========================================
Hits 9378 9378
- Misses 1700 1701 +1
- Partials 542 543 +1 ☔ View full report in Codecov by Sentry. |
Alright it looks like my conditional gh action test
which should be that's about as much time as i have for solving a docker problem! up to y'all whether we want to leave it like that or just take that line out. won't be offended if you close this and just PR removing the line, idrc about the docker stuff! |
Did you consider this? uses: actions/checkout@v4
with:
fetch-depth: 0 According to the docs:
That's what we use on other projects I work on, and it seems to work fine. I was actually surprised to see we weren't already using it here. I believe that would make the dynamic versioning correct for both tag-based and non-tag-based builds. The downside is perhaps a slightly slower checkout? I'm not sure you'd even really notice in practice. |
Hell ya the only reason I didn't was bc it wasnt already like that and I didnt want to be the one to blast the full clone if we were trying to sip resources for some reason. Feel free to edit/close this PR and do that :) |
I had trouble updating this branch (probably my fault) so I just created a PR on a new branch: #2022 |
Fix: #2007
@pkalita-lbl basically did all the work for this -
COPY
.git directory by usingADD
#1980 made the docker build action do a depth=100 fetch instead of a depth=1 fetch to catch the most recent tagged version (hopefully, it's sort of a hack since there's no builtin method of "fetch up to the most recent tag in this branch").compared to
I've never actually used
refspec
syntax like that before, but the docs are here:so basically the second one works because it will fetch that commit and create a ref under the usual
refs/remotes/origin/main
and since the--no-tags
flag isn't given, it will also grab the remote ref for the tag into/refs/tags/v1.7.6
- two refs to two refs. the second one fails because it is fetching the commit and the tag into the same ref/refs/tags/v1.7.6
. That's because a tag push is a separate event from a commit push (the linked examples are from the commit vs tag push for a given commit) and thus has the tag ref as the current{{github.ref}}
.since the purpose for the change in the first place was to make sure we have tags, and the tag-triggered actions by definition fetch the tag, introducing a switch that only fetches tags when the action is triggered by a commit. doing it this way vs. adding an additional
run
command bc of the extremely mild overhead of adding an extra step.opening this PR not as a draft while still working on it so that CI runs bc it's a CI-based PR, sry for the notifs.
theoretically this should apply to all CI actions but docker is the only action that runs on a new tag. unsure why that is, just fixing it.