-
Notifications
You must be signed in to change notification settings - Fork 29
feat(typescript): add tutorial for writing policies with typescript/javascript #663
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
base: main
Are you sure you want to change the base?
Conversation
…avascript Signed-off-by: Esosa Ohangbon <[email protected]>
✅ Deploy Preview for docs-kubewarden-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor few suggestions for consideration. From a few sources. I'll have another run through when they have been incorporated. Thank you. Looking good.
Co-authored-by: Daria Vladykina <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: Daria Vladykina <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: Daria Vladykina <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: Daria Vladykina <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: Daria Vladykina <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
done! @jhkrug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @esosaoh. I think this is the last set of changes. Just all for consistency and taking note of some terminology suggestions from the checkers. Nearly there. Thanks!
docs/tutorials/writing-policies/typescript/01-intro-typescript.md
Outdated
Show resolved
Hide resolved
docs/tutorials/writing-policies/typescript/01-intro-typescript.md
Outdated
Show resolved
Hide resolved
docs/tutorials/writing-policies/typescript/01-intro-typescript.md
Outdated
Show resolved
Hide resolved
docs/tutorials/writing-policies/typescript/01-intro-typescript.md
Outdated
Show resolved
Hide resolved
docs/tutorials/writing-policies/typescript/01-intro-typescript.md
Outdated
Show resolved
Hide resolved
docs/tutorials/writing-policies/typescript/03-policy-settings.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't get the tutorial to work at the moment.
docs/tutorials/writing-policies/typescript/01-intro-typescript.md
Outdated
Show resolved
Hide resolved
## Testing | ||
|
||
Provided the necessary tools are in place, the `make all` command builds the `annotated-policy.wasm` target. The command `make e2e` runs tests using `bats` with `kwctl`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying make all
I am unsuccessful. Any suggestions?
Using
[~/projects/suse/kubewarden/testing/test-js-policy][main|u=]
‽ node --version
v24.0.1
[~/projects/suse/kubewarden/testing/test-js-policy][main|u=]
‽ javy --version
javy 6.0.0
[~/projects/suse/kubewarden/testing/test-js-policy][main|u=]
‽ kwctl --version
kwctl 1.28.1
Use the `info` command to display system information.
[~/projects/suse/kubewarden/testing/test-js-policy][main|u=]
‽ bats --version
Bats 1.12.0
[~/projects/suse/kubewarden/testing/test-js-policy][main|u=]
‽
I get:
⸘ git remote -v
origin [email protected]:jhkrug/test-js-policy.git (fetch)
origin [email protected]:jhkrug/test-js-policy.git (push)
[~/projects/suse/kubewarden/testing/test-js-policy][main|u=]
⸘ make clean
npm cache clean --force
npm warn using --force Recommended protections disabled.
rm -f policy.wasm annotated-policy.wasm
rm -rf dist dist-ts node_modules package-lock.json
[~/projects/suse/kubewarden/testing/test-js-policy][main *|u=]
‽ make all
npm install
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
added 399 packages, and audited 400 packages in 14s
59 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
npm run build
> [email protected] build
> npx webpack --config webpack.config.cjs
asset bundled.js 5.52 KiB [emitted] [minimized] (name: main)
asset types.d.ts 430 bytes [emitted]
asset index.d.ts 11 bytes [emitted]
./src/index.ts 3.84 KiB [built] [code generated]
./node_modules/kubewarden-policy-sdk/dist/bundle.js 3.85 KiB [built] [code generated]
webpack 5.101.3 compiled successfully in 1530 ms
npm install
added 1 package, and audited 401 packages in 996ms
59 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
javy build dist/bundled.js -C plugin=node_modules/kubewarden-policy-sdk/plugin/javy-plugin-kubewarden.wasm -o policy.wasm
Error: Could not process plugin: Using unsupported legacy plugin API
make: *** [Makefile:16: policy.wasm] Error 1
[~/projects/suse/kubewarden/testing/test-js-policy][main|u=]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@esosaoh can you please check and list the needed changes for this to work?
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Co-authored-by: John Krug <[email protected]> Signed-off-by: Esosa Ohangbon <[email protected]>
Description
Fix kubewarden/policy-sdk-js#190
Test
To test this pull request, you can run the following commands:
Additional Information
Tradeoff
Potential improvement