Skip to content

fix: allow latest versions to fallback to source#47

Open
zchsh wants to merge 9 commits into
mainfrom
zs.resolve-packer-plugin-latest-to-tag
Open

fix: allow latest versions to fallback to source#47
zchsh wants to merge 9 commits into
mainfrom
zs.resolve-packer-plugin-latest-to-tag

Conversation

@zchsh
Copy link
Copy Markdown
Contributor

@zchsh zchsh commented May 10, 2022

🎟️ Asana Task


Description

In brief, this PR resolves all latest version properties to specific tags as a first step in resolving plugin docs. See the changesets file for details.

PR Checklist 🚀

  • Conduct thorough self-review.
  • Add or update tests as appropriate.
  • Write a useful description (above) to give reviewers appropriate context.
  • Identify (in the description above) and document (add Asana tasks on this board) any technical debt that you're aware of, but are not addressing as part of this PR.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 10, 2022

🦋 Changeset detected

Latest commit: fa5c6e3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hashicorp/platform-packer-plugins Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@zchsh zchsh added the release:canary Publish a canary release label May 10, 2022
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 10, 2022

📦 Canary Packages Published

Latest commit: fa5c6e3

Published 1 packages

@hashicorp/platform-packer-plugins@0.3.0-canary-2022410192647

npm install @hashicorp/platform-packer-plugins@canary

publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

cc @brkalow has more context on this, I forgot the details of this despite going over it two minutes ago 😅

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oops, we need to use a PAT instead of the GH actions token so our workflows can open PRs. A recent GitHub security fix restricted GH actions from being able to open PRs by default.

const docsMdxFiles = docsEntries
.filter((e) => {
return path.extname(e.entryName) === '.mdx'
return isValidDocsContentPath(e.entryName)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moves the filtering of content paths into one function. That's now where we determine whether a file is a valid content (now either .md or .mdx).

* Return a string representing the latest release tag in that repo,
* or false if the latest tag cannot be resolved.
*/
export async function fetchLatestReleaseTag(repo: string): Promise<string> {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is swiped from hashicorp/dev-portal. It allows us to resolve the latest version to an explicit tag.

// and that there is at least one component subfolder
// with at least one .mdx file within it.
export function validatePluginDocsFiles(filePaths: string[]) {
function isValidPath(filePath: string) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved into the is-valid-docs-file-path.ts util function.

@zchsh zchsh marked this pull request as ready for review May 10, 2022 19:11
@zchsh
Copy link
Copy Markdown
Contributor Author

zchsh commented May 10, 2022

@brkalow I've tested this out in hashicorp/dev-portal#413 & hashicorp/dev-portal#414.

Right now it's working in combination with hashicorp/packer#11771 which has been merged in, intent being that once we've published this fix, and added it to dev-portal, we should be able to use latest again in more cases.

Let me know what you think 🙇‍♂️

@zchsh zchsh requested a review from brkalow May 10, 2022 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:canary Publish a canary release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants