diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index eca88bb1ac..3aa8adbe37 100755 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -23,6 +23,7 @@ assignees: "" - Go Version: 1.22.2 +- Rust Version: 1.77.2 - Docker Version: 20.10.8 - Kubernetes Version: v1.29.3 - NGT Version: 2.2 diff --git a/.github/ISSUE_TEMPLATE/security_issue_report.md b/.github/ISSUE_TEMPLATE/security_issue_report.md index 1d06c5eea2..acdb5fe9f6 100644 --- a/.github/ISSUE_TEMPLATE/security_issue_report.md +++ b/.github/ISSUE_TEMPLATE/security_issue_report.md @@ -17,6 +17,7 @@ assignees: "" - Go Version: 1.22.2 +- Rust Version: 1.77.2 - Docker Version: 20.10.8 - Kubernetes Version: v1.29.3 - NGT Version: 2.2 diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d71230147f..033441ad8f 100755 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -17,6 +17,7 @@ - Go Version: 1.22.2 +- Rust Version: 1.77.2 - Docker Version: 20.10.8 - Kubernetes Version: v1.29.3 - NGT Version: 2.2 diff --git a/.github/workflows/update-pull-request-and-issue-template.yml b/.github/workflows/update-pull-request-and-issue-template.yml index 0cf7de9d82..7394cd4aae 100644 --- a/.github/workflows/update-pull-request-and-issue-template.yml +++ b/.github/workflows/update-pull-request-and-issue-template.yml @@ -22,6 +22,7 @@ on: - "versions/GO_VERSION" - "versions/NGT_VERSION" - "versions/KUBECTL_VERSION" + - "versions/RUST_VERSION" jobs: dump-contexts-to-log: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 0056296e61..fc459a535a 100644 --- a/Makefile +++ b/Makefile @@ -59,9 +59,10 @@ GO_CLEAN_DEPS := true GOTEST_TIMEOUT = 30m CGO_ENABLED = 1 -RUST_HOME = /usr/local/lib/rust -RUSTUP_HOME = $(RUST_HOME)/rustup -CARGO_HOME = $(RUST_HOME)/cargo +RUST_HOME ?= /usr/local/lib/rust +RUSTUP_HOME ?= $(RUST_HOME)/rustup +CARGO_HOME ?= $(RUST_HOME)/cargo +RUST_VERSION := $(eval RUST_VERSION := $(shell cat versions/RUST_VERSION))$(RUST_VERSION) NPM_GLOBAL_PREFIX := $(eval NPM_GLOBAL_PREFIX := $(shell npm prefix --location=global))$(NPM_GLOBAL_PREFIX) @@ -539,6 +540,11 @@ version/vald: version/go: @echo $(GO_VERSION) +.PHONY: version/rust +## print rust version +version/rust: + @echo $(RUST_VERSION) + .PHONY: version/ngt ## print NGT version version/ngt: diff --git a/Makefile.d/dependencies.mk b/Makefile.d/dependencies.mk index 878dd866bd..122f3d8af5 100644 --- a/Makefile.d/dependencies.mk +++ b/Makefile.d/dependencies.mk @@ -85,15 +85,8 @@ go/example/deps: ## install Rust package dependencies rust/deps: \ rust/install - if [ -x "$(CARGO_HOME)/bin/cargo" ]; then \ - cd $(ROOTDIR)/rust \ - && $(CARGO_HOME)/bin/rustup default stable \ - && $(CARGO_HOME)/bin/cargo update \ - && cd -;\ - else \ - echo "Cargo not found. Please install Cargo or add it to your PATH."; \ - exit 1; \ - fi + sed -i "2s/channel = \"[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\"/channel = \"$(RUST_VERSION)\"/g" $(ROOTDIR)/rust/rust-toolchain.toml + cd $(ROOTDIR)/rust && $(CARGO_HOME)/bin/cargo update && cd - .PHONY: update/chaos-mesh ## update chaos-mesh version @@ -122,6 +115,11 @@ update/go: update/golangci-lint: curl --silent https://api.github.com/repos/golangci/golangci-lint/releases/latest | grep -Po '"tag_name": "\K.*?(?=")' > $(ROOTDIR)/versions/GOLANGCILINT_VERSION +.PHONY: update/rust +## update rust version +update/rust: + curl --silent https://releases.rs | grep -Po 'Stable: \K[\d.]+\s' | head -n 1 > $(ROOTDIR)/versions/RUST_VERSION + .PHONY: update/helm ## update helm version update/helm: @@ -223,6 +221,7 @@ update/template: $(eval GO_VERSION := $(shell $(MAKE) -s version/go)) $(eval NGT_VERSION := $(shell $(MAKE) -s version/ngt)) $(eval KUBECTL_VERSION := $(shell $(MAKE) -s version/k8s)) + $(eval RUST_VERSION := $(shell $(MAKE) -s version/rust)) sed -i -e "s/^- Go Version: .*$$/- Go Version: $(GO_VERSION)/" $(ROOTDIR)/.github/ISSUE_TEMPLATE/bug_report.md sed -i -e "s/^- Go Version: .*$$/- Go Version: $(GO_VERSION)/" $(ROOTDIR)/.github/ISSUE_TEMPLATE/security_issue_report.md sed -i -e "s/^- Go Version: .*$$/- Go Version: $(GO_VERSION)/" $(ROOTDIR)/.github/PULL_REQUEST_TEMPLATE.md @@ -234,3 +233,7 @@ update/template: sed -i -e "s/^- Kubernetes Version: .*$$/- Kubernetes Version: $(KUBECTL_VERSION)/" $(ROOTDIR)/.github/ISSUE_TEMPLATE/bug_report.md sed -i -e "s/^- Kubernetes Version: .*$$/- Kubernetes Version: $(KUBECTL_VERSION)/" $(ROOTDIR)/.github/ISSUE_TEMPLATE/security_issue_report.md sed -i -e "s/^- Kubernetes Version: .*$$/- Kubernetes Version: $(KUBECTL_VERSION)/" $(ROOTDIR)/.github/PULL_REQUEST_TEMPLATE.md + + sed -i -e "s/^- Rust Version: .*$$/- Rust Version: $(RUST_VERSION)/" $(ROOTDIR)/.github/ISSUE_TEMPLATE/bug_report.md + sed -i -e "s/^- Rust Version: .*$$/- Rust Version: $(RUST_VERSION)/" $(ROOTDIR)/.github/ISSUE_TEMPLATE/security_issue_report.md + sed -i -e "s/^- Rust Version: .*$$/- Rust Version: $(RUST_VERSION)/" $(ROOTDIR)/.github/PULL_REQUEST_TEMPLATE.md diff --git a/Makefile.d/docker.mk b/Makefile.d/docker.mk index c28bf82ed8..96d1db40db 100644 --- a/Makefile.d/docker.mk +++ b/Makefile.d/docker.mk @@ -117,6 +117,7 @@ docker/build/agent: @make DOCKERFILE="$(ROOTDIR)/dockers/agent/core/agent/Dockerfile" \ IMAGE=$(AGENT_IMAGE) \ DISTROLESS_IMAGE=gcr.io/distroless/cc-debian12 \ + EXTRA_ARGS="--build-arg RUST_VERSION=$(RUST_VERSION)" \ docker/build/image .PHONY: docker/name/discoverer-k8s diff --git a/Makefile.d/tools.mk b/Makefile.d/tools.mk index b0a63b540d..bb74f42e6f 100644 --- a/Makefile.d/tools.mk +++ b/Makefile.d/tools.mk @@ -162,11 +162,5 @@ $(GOROOT)/bin/go: rust/install: $(CARGO_HOME)/bin/cargo $(CARGO_HOME)/bin/cargo: - curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | CARGO_HOME=${CARGO_HOME} RUSTUP_HOME=${RUSTUP_HOME} sh -s -- --default-toolchain nightly -y - source "${CARGO_HOME}/env" \ - CARGO_HOME=${CARGO_HOME} RUSTUP_HOME=${RUSTUP_HOME} ${CARGO_HOME}/bin/rustup install stable \ - CARGO_HOME=${CARGO_HOME} RUSTUP_HOME=${RUSTUP_HOME} ${CARGO_HOME}/bin/rustup install beta \ - CARGO_HOME=${CARGO_HOME} RUSTUP_HOME=${RUSTUP_HOME} ${CARGO_HOME}/bin/rustup install nightly \ - CARGO_HOME=${CARGO_HOME} RUSTUP_HOME=${RUSTUP_HOME} ${CARGO_HOME}/bin/rustup toolchain install nightly \ - CARGO_HOME=${CARGO_HOME} RUSTUP_HOME=${RUSTUP_HOME} ${CARGO_HOME}/bin/rustup default nightly \ - CARGO_HOME=${CARGO_HOME} RUSTUP_HOME=${RUSTUP_HOME} ${CARGO_HOME}/bin/rustup update + curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | CARGO_HOME=${CARGO_HOME} RUSTUP_HOME=${RUSTUP_HOME} sh -s -- --default-toolchain $(RUST_VERSION) -y + source "${CARGO_HOME}/env" diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 2966c2a092..ec441bb120 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -164,9 +164,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" +checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" [[package]] name = "cfg-if" @@ -629,9 +629,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -725,9 +725,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.32" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", "errno", @@ -750,18 +750,18 @@ checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" dependencies = [ "proc-macro2", "quote", @@ -816,9 +816,9 @@ checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" [[package]] name = "syn" -version = "2.0.59" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -863,18 +863,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", @@ -1071,37 +1071,15 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "134306a13c5647ad6453e8deaec55d3a44d6021970129e6188735e74bf546697" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-sys" version = "0.48.0" diff --git a/rust/rust-toolchain.toml b/rust/rust-toolchain.toml new file mode 100644 index 0000000000..7e37cd2750 --- /dev/null +++ b/rust/rust-toolchain.toml @@ -0,0 +1,17 @@ +# +# Copyright (C) 2019-2024 vdaas.org vald team +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +[toolchain] +channel = "1.77.2" diff --git a/versions/RUST_VERSION b/versions/RUST_VERSION new file mode 100644 index 0000000000..6cdeba3855 --- /dev/null +++ b/versions/RUST_VERSION @@ -0,0 +1 @@ +1.77.2 \ No newline at end of file