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 rust versions #2482

Merged
merged 5 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ assignees: ""
<!--- Please change the versions below along with your environment -->

- Go Version: 1.22.2
- Rust Version: 1.77.2
- Docker Version: 20.10.8
- Kubernetes Version: v1.29.3
- NGT Version: 2.2
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/security_issue_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ assignees: ""
<!--- Please change the versions below along with your environment -->

- Go Version: 1.22.2
- Rust Version: 1.77.2
- Docker Version: 20.10.8
- Kubernetes Version: v1.29.3
- NGT Version: 2.2
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<!--- Please change the versions below along with your environment -->

- Go Version: 1.22.2
- Rust Version: 1.77.2
- Docker Version: 20.10.8
- Kubernetes Version: v1.29.3
- NGT Version: 2.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down
21 changes: 12 additions & 9 deletions Makefile.d/dependencies.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions Makefile.d/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 2 additions & 8 deletions Makefile.d/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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"
60 changes: 19 additions & 41 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions rust/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
# 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"
1 change: 1 addition & 0 deletions versions/RUST_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.77.2
Loading