Skip to content

Commit

Permalink
Fix Cargo/Rust Installation (#77)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Graeb <[email protected]>
  • Loading branch information
waahm7 and graebm authored Oct 8, 2024
1 parent f4edd09 commit 94529c8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cdk/orchestrator-job.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from amazonlinux:2023
FROM amazonlinux:2023

RUN dnf install -y python3-pip \
&& python3 -m pip install boto3
Expand Down
7 changes: 6 additions & 1 deletion cdk/per-instance-job.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from amazonlinux:2023
FROM amazonlinux:2023

RUN dnf install -y git

# Installing rustup is a pain, because you need to modify the shell afterwards.
# Easier to just do it here, vs later via install-tools-AL2023.py
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# s3_benchmarks/__init__.py is shared by CDK Stack and Batch jobs
COPY s3_benchmarks/__init__.py /s3_benchmarks/

Expand Down
2 changes: 1 addition & 1 deletion runners/s3-benchrunner-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
[dependencies]

# Swap which line is commented-out to use GitHub or local aws-s3-transfer-manager
aws-s3-transfer-manager = { git = "https://github.com/awslabs/aws-s3-transfer-manager-rs.git", rev = "9f16242e5a2a0c9d1fcc2b4d1006fb01c9c551f2" }
aws-s3-transfer-manager = { git = "https://github.com/awslabs/aws-s3-transfer-manager-rs.git", rev = "3dd20c8aa0872352100cf456beee02bfc53c73d1" }
# aws-s3-transfer-manager = { path = "../../../aws-s3-transfer-manager-rs/aws-s3-transfer-manager" }

# tracing-opentelemetry 0.26.0 is a bit broken (see https://github.com/tokio-rs/tracing-opentelemetry/issues/159)
Expand Down
24 changes: 9 additions & 15 deletions scripts/install-tools-AL2023.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python3
import argparse
import os
import os.path
import shutil
import urllib.request

Expand Down Expand Up @@ -31,16 +29,12 @@
'python3-devel', # for building aws-crt-python
])

# install rust via rustup.sh
# (the version in dnf is too old, in July 2024 it was the 1+ year old rust 1.68)
# do NOT use sudo with rustup
rustup_url = 'https://sh.rustup.rs'
rustup_filepath = '/tmp/rustup.sh'
print(f'downloading: {rustup_url} -> {rustup_filepath} ...')
urllib.request.urlretrieve(rustup_url, rustup_filepath)
run(['sh', rustup_filepath, '-y'])

# add rust to path, so current process can run it without reloading shell
PATH = os.environ['PATH']
if '.cargo/bin' not in PATH:
os.environ['PATH'] = f"{PATH}:{os.path.expanduser('~/.cargo/bin')}"
if not shutil.which('cargo'):
# install rust via rustup.sh
# (the version in dnf is too old, in July 2024 it was the 1+ year old rust 1.68)
# do NOT use sudo with rustup
rustup_url = 'https://sh.rustup.rs'
rustup_filepath = '/tmp/rustup.sh'
print(f'downloading: {rustup_url} -> {rustup_filepath} ...')
urllib.request.urlretrieve(rustup_url, rustup_filepath)
run(['sh', rustup_filepath, '-y'])

0 comments on commit 94529c8

Please sign in to comment.