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

Add option to enforce refs on whippet deps validate #245

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

RobjS
Copy link
Contributor

@RobjS RobjS commented Jul 17, 2024

This commit adds an --enforce-refs option that can be passed into whippet deps validate that will cause it to fail if a dependency in whippet.json is missing a "ref" property.

This will facilitate us in enabling automatic plugin updates, as we'll be able to update our shared whippet validation workflow to fail if references are missing, thereby ensuring that all dependencies have a reference and therefore can't be accidentally updated beyond e.g. a major version tag, or a specific pinned version.

Note that like the other checks in whippet deps validate, this does not check whether the reference provided exists and is valid, it just checks one is provided. An implicit check on the validity of the reference itself happens when whippet deps update or whippet deps install is run.

How to test

  1. Run the automated test suite with ./script/test
  2. Use a symlink or alias so you can run /bin/whippet from this repo (e.g. I have whippet-dev aliased to that file)
  3. Clone https://github.com/dxw/wordpress-template, and run your equivalent of whippet-dev deps validate -r on that repo. It should fail
  4. Replace the template whippet.json with:
    {
     "src": {
         "plugins": "[email protected]:dxw-wordpress-plugins/"
     },
     "plugins": [
         {"name": "akismet", "ref": "v5"},
         {"name": "advanced-custom-fields-pro", "ref": "v6"}
     ]
    }
  5. Run whippet deps update, then run whippet-dev deps validate -r again. Validation should now pass.
  • Includes tests (if new features are introduced)
  • Commit message includes link to the ticket/issue
  • Changelog updated
  • PR open against dxw's Homebrew Tap to point the Whippet formula to the new version number

This commit adds an `--enforce-refs` option that can be passed into
`whippet deps validate` that will cause it to fail if a dependency in
whippet.json is missing a "ref" property.

This will facilitate us in enabling automatic plugin updates, we we'll
be able to update our shared whippet validation workflow to fail if
references are missing, thereby ensuring that all dependencies have a
reference and therefore can't be accidentally updated beyond e.g. a
major version tag, or a specific pinned version.

Note that like the other checks in `whippet deps validate`, this does
not check whether the reference provided exists and is valid, it just
checks one is provided. An implicit check on the validity of the
reference itself happens when `whippet deps update` or `whippet deps
install` is run.
@snim2 snim2 self-requested a review July 17, 2024 10:53
Copy link
Contributor

@snim2 snim2 left a comment

Choose a reason for hiding this comment

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

Tests run and this works locally for me :)

@RobjS RobjS merged commit 408d061 into main Jul 18, 2024
5 checks passed
RobjS added a commit to dxw/govpress-workflow-whippet-validate that referenced this pull request Aug 8, 2024
As part of the work to automate plugin updates, we want to ensure that
we don't accidentally deploy a breaking change when running `whippet
deps update`. The best way to do this currently is to pin all plugins to
a specific git reference (normally the major version tag for the current
release).

This change ensures that the workflow will fail if a file in
`whippet.json` does not have a reference specified.

See dxw/whippet#245 for where this feature was
added to Whippet.
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