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

Fix fetch test for update script when releasing a new version #1205

Closed
domoscargin opened this issue Dec 16, 2021 · 3 comments · Fixed by #1206
Closed

Fix fetch test for update script when releasing a new version #1205

domoscargin opened this issue Dec 16, 2021 · 3 comments · Fixed by #1206
Labels
🐛 Bug Something isn't working the way it should (including incorrect wording in documentation)

Comments

@domoscargin
Copy link
Contributor

domoscargin commented Dec 16, 2021

What

While we were in the process of releasing version 12, we discovered that the fetch test for the update script began to fail.

(See for example test run #1173).

The update script tests check VERSION.txt for the latest version. Because we'd already merged to main, the version there was 12.0.0.

However, since we had not yet released, the latest release archive was 11.0.0. The test then failed because it couldn't find an archive with a name ending in -12.0.0.

We need to update the test so that it takes into account this "between release" state, where the main branch has the updated content, but we have an old release archive.

@domoscargin domoscargin added Feature Request User requests a new feature awaiting triage labels Dec 16, 2021
@lfdebrux
Copy link
Member

This is a doozy. Thanks for the great write-up!

@domoscargin domoscargin added 🐛 Bug Something isn't working the way it should (including incorrect wording in documentation) and removed Feature Request User requests a new feature labels Dec 16, 2021
@joelanman
Copy link
Contributor

possibly the latestReleaseVersion could be read from GitHub somehow instead of looking locally

https://docs.github.com/en/rest/reference/releases

@lfdebrux
Copy link
Member

possibly the latestReleaseVersion could be read from GitHub somehow instead of looking locally

https://docs.github.com/en/rest/reference/releases

Yep that would work.

lfdebrux added a commit that referenced this issue Dec 16, 2021
Previously we were relying on VERSION.txt for the name of the latest
release, however this doesn't work in scenarios where we have changed
the version number in preperation but have not yet made the release, as
we found recently (see issue #1205).

Instead we get the latest release version using the `latest-release`
branch, which is updated automatically after a change to VERSION.txt is
merged to main [[1]]. Note that we have to drop the `v` at the beginning
of the tag name, because for some reason GitHub doesn't include that in
the archive file name. Also note that this can break in situations where
the local repository is out-of-sync with the remote; we could have used
the GitHub releases API to achieve the same effect and avoid this issue
[[2]], but it would have been slower and a lot more code.

[1]: https://github.com/alphagov/govuk-prototype-kit/blob/main/.github/workflows/create-release-tag.yaml
[2]: #1205 (comment)
lfdebrux added a commit that referenced this issue Dec 16, 2021
Previously we were relying on VERSION.txt for the name of the latest
release, however this doesn't work in scenarios where we have changed
the version number in preperation but have not yet made the release, as
we found recently (see issue #1205).

Instead we get the latest release version using the GitHub API [[1]].
Note that we have to drop the `v` at the beginning of the tag name,
because for some reason GitHub doesn't include that in the archive file
name.

This commit uses the `superagent` library to do the request to avoid a
lot of boilerplate; note that we have to set the user agent to
something, because otherwise GitHub will forbid the request [[2]].

[1]: #1205 (comment)
[2]: ladjs/superagent#1495 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working the way it should (including incorrect wording in documentation)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants