kubewarden / kubewarden-controller

Manage admission policies in your Kubernetes cluster with ease
https://kubewarden.io
Apache License 2.0
195 stars 33 forks source link

Rust policies: move to wasm32-wasip1 target #757

Closed flavio closed 5 months ago

flavio commented 5 months ago

The wasm32-wasi target is deprecated and is has already been renamed wasm32-wasip1. See this blog post

Actions:

viccuad commented 5 months ago

Opened all the needed PRs for policies. Tried with existing tools such as all-repos, but it was not worth the hassle. At the end I did:

  1. Clone repos:

      gh repo list kubewarden --language rust --topic kubewarden-policy | while read -r repo \_; do
        gh repo clone "$repo" "$repo"
      done
  2. Edit repos:

    for repo in kubewarden/*; do
      echo "$repo"
      pushd "$repo"
      git checkout -b wasip1
      find ./ -type f -exec sed -i 's/cargo build --target=wasm32-wasi --release/cargo build --target=wasm32-wasip1 --release/g' {} \;
      find ./ -type f -exec sed -i 's/cp target\/wasm32-wasi\/release\/\*.wasm policy.wasm/cp target\/wasm32-wasip1\/release\/\*.wasm policy.wasm/g' {} \;
      git add *
      git commit --file ../../message.txt
      popd
    done
  3. Use editor to loop through all aparitions of wasm32 to double check

  4. Open PRs:

    for repo in kubewarden/*; do
      echo "$repo"
      pushd "$repo"
      # note: `--project Kubewarden` doesn't get recognized for all repos
      gh pr create --assignee viccuad --base main --title 'chore(deps): move to wasm32-wasip1 target' --body-file ../../body-pr.txt --fill
      popd
    done
viccuad commented 5 months ago

All Rust policies done, closing as done.