Skip to content

Commit

Permalink
Build and validate SLES package (#1278)
Browse files Browse the repository at this point in the history
Build a separate package for SUSE Linux Enterprise Server (SLES), where
`libfuse.so.2` is delivered by `libfuse2` rpm package (as compared to
`fuse-libs` for AL2).

### Does this change impact existing behavior?

No.

### Does this change need a changelog entry? Does it require a version
change?

May be? Added.

---

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and I agree to the terms of
the [Developer Certificate of Origin
(DCO)](https://developercertificate.org/).

---------

Signed-off-by: Vlad Volodkin <[email protected]>
Co-authored-by: Vlad Volodkin <[email protected]>
  • Loading branch information
vladem and Vlad Volodkin authored Feb 26, 2025
1 parent 48ca4df commit 59ccecf
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 22 deletions.
33 changes: 32 additions & 1 deletion doc/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Mountpoint for Amazon S3 is only available for Linux operating systems.

The instructions for downloading and installing Mountpoint for Amazon S3 depend on which Linux operating system you are using.

### RPM-based distributions (Amazon Linux, Fedora, CentOS, RHEL)
### RPM-based distributions (Amazon Linux, Fedora, CentOS, RHEL; excluding SUSE)

To download and install Mountpoint for Amazon S3 on RPM-based distributions, including Amazon Linux, follow these steps:

Expand Down Expand Up @@ -77,6 +77,37 @@ To download and install Mountpoint for Amazon S3 on DEB-based distributions, fol
mount-s3 1.0.0
```
### On SUSE Linux Enterprise Server (SLES)
To download and install Mountpoint for Amazon S3 on SLES, follow these steps:
1. Download the Mountpoint for Amazon S3 package using the appropriate command for your architecture:
* x86_64:
```
wget https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.suse.rpm
```
* ARM64 (Graviton):
```
wget https://s3.amazonaws.com/mountpoint-s3-release/latest/arm64/mount-s3.suse.rpm
```
2. Optionally, you can verify authenticity and integrity of the downloaded file. Identify the appropriate signature link depending on your architecture:
* x86_64 architecture: `https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.suse.rpm.asc`
* ARM64 (Graviton) architecture: `https://s3.amazonaws.com/mountpoint-s3-release/latest/arm64/mount-s3.suse.rpm.asc`
Then see [Verifying the signature of the Mountpoint for Amazon S3 package](#optional-verifying-the-signature-of-the-mountpoint-for-amazon-s3-package) below.
3. Install the package by entering the following command:
```
sudo zypper refresh && sudo zypper --no-gpg-checks install -y ./mount-s3.suse.rpm
```
4. Verify that Mountpoint for Amazon S3 is successfully installed by entering the following command:
```
mount-s3 --version
```
You should see output similar to the following:
```
mount-s3 1.0.0
```
### Other Linux distributions
To download and install Mountpoint for Amazon S3 on other Linux distributions, follow these steps:
Expand Down
1 change: 1 addition & 0 deletions mountpoint-s3/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
### Other changes

* Add support for appending to objects originally uploaded with a CRC64-NVME checksum. ([#1235](https://github.com/awslabs/mountpoint-s3/pull/1235))
* Add a package for SUSE Linux Enterprise Server (SLES). ([#1278](https://github.com/awslabs/mountpoint-s3/pull/1278))

### Breaking changes

Expand Down
40 changes: 40 additions & 0 deletions package/mount-s3-suse.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Name: mount-s3
Version: %{MOUNTPOINT_VERSION}
Release: 1
Summary: Mountpoint for Amazon S3

License: Apache-2.0
URL: https://github.com/awslabs/mountpoint-s3
Source0: mount-s3.tar.gz

Requires: ca-certificates
Requires: fuse
Requires: libfuse2

%description
Mountpoint for Amazon S3 is a simple, high-throughput file client for
mounting an Amazon S3 bucket as a local file system. With Mountpoint for Amazon
S3, your applications can access objects stored in Amazon S3 through file
operations like open and read. Mountpoint for Amazon S3 automatically
translates these operations into S3 object API calls, giving your applications
access to the elastic storage and throughput of Amazon S3 through a file
interface.

%prep
%setup -c %{name}-%{version}

%install
rm -rf %{buildroot}/*
cp -r %{_builddir}/%{name}-%{version}/* %{buildroot}/
mkdir -p %{buildroot}/%{_bindir}
ln -f -s /opt/aws/mountpoint-s3/bin/mount-s3 %{buildroot}/%{_bindir}/mount-s3

%files
%dir /opt/aws/mountpoint-s3
%dir /opt/aws/mountpoint-s3/bin
/opt/aws/mountpoint-s3/bin/mount-s3
%doc /opt/aws/mountpoint-s3/NOTICE
%license /opt/aws/mountpoint-s3/LICENSE
/opt/aws/mountpoint-s3/THIRD_PARTY_LICENSES
/opt/aws/mountpoint-s3/VERSION
%{_bindir}/mount-s3
23 changes: 17 additions & 6 deletions package/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class BuildMetadata:
def artifact_name(self, extension: str):
return f"mount-s3-{self.version_string}-{self.arch_name}.{extension}"

def spec_file_name(self, distr: Optional[str]=None):
if distr:
return f"mount-s3-{distr}.spec"
return "mount-s3.spec"


OPT_PATH = "opt/aws/mountpoint-s3"

Expand Down Expand Up @@ -200,15 +205,18 @@ def build_package_dir(metadata: BuildMetadata, binary_path: str, attribution_pat
return package_dir


def build_rpm(metadata: BuildMetadata, package_dir: str) -> str:
def build_rpm(metadata: BuildMetadata, package_dir: str, distr: Optional[str]=None) -> str:
"""Build an RPM package from the contents of the package directory. Return the path to the
final RPM package."""

rpm_topdir = os.path.join(metadata.buildroot, "rpm-topdir")
log(f"Building RPM in topdir {rpm_topdir}")
rpm_buildroot = os.path.join(metadata.buildroot, "rpm-{}".format(distr or "default"))
os.mkdir(rpm_buildroot)

rpm_topdir = os.path.join(rpm_buildroot, "rpm-topdir")
log("Building RPM in topdir {} for {} Linux distribution".format(rpm_topdir, distr or "default"))

# Assemble the contents of the RPM, rooted at /
rpm_package_dir = os.path.join(metadata.buildroot, "rpm-package")
rpm_package_dir = os.path.join(rpm_buildroot, "rpm-package")
rpm_opt_dir = os.path.join(rpm_package_dir, OPT_PATH)
shutil.copytree(package_dir, rpm_opt_dir)

Expand All @@ -219,7 +227,7 @@ def build_rpm(metadata: BuildMetadata, package_dir: str) -> str:
run(["tar", "czvf", source_tar_path, "-C", rpm_package_dir, "opt"])

# Build the RPM
spec_file = os.path.join(metadata.cargoroot, "package/mount-s3.spec")
spec_file = os.path.join(metadata.cargoroot, f"package/{metadata.spec_file_name(distr)}")
cmd = [
"rpmbuild",
"-bb",
Expand All @@ -236,7 +244,7 @@ def build_rpm(metadata: BuildMetadata, package_dir: str) -> str:
rpms = os.listdir(arch_dir)
assert len(rpms) == 1
rpm_path = os.path.join(arch_dir, rpms[0])
final_rpm_path = os.path.join(metadata.output_dir, metadata.artifact_name("rpm"))
final_rpm_path = os.path.join(metadata.output_dir, metadata.artifact_name("{}.rpm".format(distr) if distr else "rpm"))
shutil.copy2(rpm_path, final_rpm_path)

log(f"Built RPM: {final_rpm_path}")
Expand Down Expand Up @@ -316,6 +324,8 @@ def build(args: argparse.Namespace) -> str:
artifacts = []
if not args.no_rpm:
artifacts.append(build_rpm(metadata, package_dir))
if not args.no_suse_rpm:
artifacts.append(build_rpm(metadata, package_dir, "suse"))
if not args.no_deb:
artifacts.append(build_deb(metadata, package_dir))
artifacts.append(build_package_archive(metadata, package_dir))
Expand All @@ -331,6 +341,7 @@ def build(args: argparse.Namespace) -> str:
p.add_argument("--root-dir", help="override the path to the Cargo workspace")
p.add_argument("--expected-version", help="expected version number for the Mountpoint binary")
p.add_argument("--no-rpm", action="store_true", help="do not build an RPM")
p.add_argument("--no-suse-rpm", action="store_true", help="do not build an RPM for SUSE")
p.add_argument("--no-deb", action="store_true", help="do not build a DEB")
p.add_argument("--official", action="store_true", help="build as an official release")

Expand Down
18 changes: 18 additions & 0 deletions package/validate/validate-rpm-suse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /bin/sh
set -e

cat /etc/os-release

zypper refresh && zypper install -y wget
cd /tmp

wget https://s3.amazonaws.com/mountpoint-s3-release/$VERSION/$ARCH/mount-s3-$VERSION-$ARCH.suse.rpm
wget https://s3.amazonaws.com/mountpoint-s3-release/$VERSION/$ARCH/mount-s3-$VERSION-$ARCH.suse.rpm.asc

wget https://s3.amazonaws.com/mountpoint-s3-release/public_keys/KEYS
gpg --import KEYS
gpg --verify mount-s3-$VERSION-$ARCH.suse.rpm.asc mount-s3-$VERSION-$ARCH.suse.rpm

zypper --no-gpg-checks install -y mount-s3-$VERSION-$ARCH.suse.rpm

. $(dirname "$0")/test-mount-s3.sh
31 changes: 16 additions & 15 deletions package/validate/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ def validate(args: argparse.Namespace) -> str:

package=f"{args.artifact}-{args.os}"
if package == "deb-ubuntu":
image = "ubuntu/ubuntu:20.04"
image = "public.ecr.aws/ubuntu/ubuntu:20.04"
elif package == "rpm-al2" or package == "gzip-al2":
image = "amazonlinux/amazonlinux:2"
image = "public.ecr.aws/amazonlinux/amazonlinux:2"
elif package == "rpm-suse":
image = "registry.suse.com/bci/bci-base:15.6"
else:
raise Exception(f"unsupported OS {args.os} for {args.artifact}. Supported combinations are: deb-ubuntu, rpm-al2, gzip-al2")
raise Exception(f"unsupported OS {args.os} for {args.artifact}. Supported combinations are: deb-ubuntu, rpm-al2, gzip-al2, rpm-suse")

print("Validating Mountpoint Release Package")
print(f"\tVersion: {args.version}")
Expand All @@ -29,30 +31,29 @@ def validate(args: argparse.Namespace) -> str:
print(f"\tBucket: {args.bucket}")
print("\n")

full_image = f"public.ecr.aws/{image}"
validate_script = f"validate-{package}.sh"
scripts_dir = os.path.dirname(os.path.realpath(__file__))

subprocess.run(["docker", "pull", full_image])
subprocess.run(["docker",
subprocess.run(["docker", "pull", image])
subprocess.run(["docker",
"run",
"--rm",
"--cap-add=SYS_ADMIN",
"--device=/dev/fuse",
f"-v={scripts_dir}:/scripts",
f"--env=ARCH={args.arch}",
f"--env=VERSION={args.version}",
"--rm",
"--cap-add=SYS_ADMIN",
"--device=/dev/fuse",
f"-v={scripts_dir}:/scripts",
f"--env=ARCH={args.arch}",
f"--env=VERSION={args.version}",
f"--env=BUCKET={args.bucket}",
full_image,
"/bin/bash",
image,
"/bin/bash",
f"/scripts/{validate_script}"])

if __name__ == "__main__":
p = argparse.ArgumentParser()
p.add_argument("--version", help="the version number for the Mountpoint release", required=True)
p.add_argument("--arch", help="the architecture to validate", required=True, choices=["x86_64", "arm64"])
p.add_argument("--artifact", help="the artifact to validate", required=True, choices=["deb", "rpm", "gzip"])
p.add_argument("--os", help="the OS to validate on", required=True, choices=["ubuntu", "al2"])
p.add_argument("--os", help="the OS to validate on", required=True, choices=["ubuntu", "al2", "suse"])
p.add_argument("--bucket", help="the public bucket to mount", required=True)

args = p.parse_args()
Expand Down

0 comments on commit 59ccecf

Please sign in to comment.