Commit 6309b6ce authored by Yuan Gao's avatar Yuan Gao
Browse files

Merge PR #60 on GitHub. Adds support for AssumeRoleWithWebIdentity.

parent 2696a77b
......@@ -29,6 +29,8 @@ commands:
command: |
source ~/efs-utils-virtualenv/bin/activate
make test
- store_artifacts:
path: build
build-deb:
steps:
- checkout
......@@ -58,7 +60,7 @@ commands:
- run:
name: Install dependencies
command: |
yum -y install rpm-build make
yum -y install rpm-build make systemd
- run:
name: Build RPM
command: |
......
/amazon-efs-utils*
!amazon-efs-utils.spec
.coverage
.pytest_cache
......
......@@ -17,7 +17,6 @@ clean:
rm -rf $(BUILD_DIR)
rm -rf $(PACKAGE_NAME)
rm -f $(SOURCE_TARBALL)
rm -f $(SPECFILE)
.PHONY: tarball
tarball: clean
......@@ -38,13 +37,6 @@ tarball: clean
tar -czf $(SOURCE_TARBALL) $(PACKAGE_NAME)/*
.PHONY: specfile
specfile: clean
ln -sf dist/$(SPECFILE) $(SPECFILE)
.PHONY: sources
sources: tarball specfile
.PHONY: shebang-support
shebang-support:
./mangle-shebangs.sh
......@@ -58,7 +50,7 @@ rpm-only:
cp $(BUILD_DIR)/RPMS/*/*rpm build
.PHONY: rpm
rpm: shebang-support sources rpm-only
rpm: shebang-support tarball rpm-only
.PHONY: deb
deb:
......
......@@ -25,9 +25,15 @@
%global with_systemd 1
%endif
%if 0%{?is_opensuse}
%global platform .opensuse
%else
%global platform %{dist}
%endif
Name : amazon-efs-utils
Version : 1.26
Release : 3%{?dist}
Version : 1.27.1
Release : 1%{platform}
Summary : This package provides utilities for simplifying the use of EFS file systems
Group : Amazon/Tools
......@@ -126,6 +132,9 @@ fi
%clean
%changelog
* Tue Aug 4 2020 Karthik Basavaraj <kbbasav@amazon.com> - 1.27.1
- Merge PR #60 on GitHub. Adds support for AssumeRoleWithWebIdentity
* Wed Jul 1 2020 Yuan Gao <ygaochn@amazon.com> - 1.26.3
- Fix an issue where watchdog crashed during restart because stunnel was killed and pid key was removed from state file
......
......@@ -11,7 +11,8 @@ set -ex
BASE_DIR=$(pwd)
BUILD_ROOT=${BASE_DIR}/build/debbuild
VERSION=1.26.3
VERSION=1.27.1
RELEASE=1
DEB_SYSTEM_RELEASE_PATH=/etc/os-release
UBUNTU18_REGEX="Ubuntu 18"
DEBIAN11_REGEX="Debian GNU/Linux bullseye"
......@@ -73,7 +74,7 @@ tar czf data.tar.gz etc sbin usr var --owner=0 --group=0
cd ${BASE_DIR}
echo 'Building deb'
DEB=${BUILD_ROOT}/amazon-efs-utils-${VERSION}.deb
DEB=${BUILD_ROOT}/amazon-efs-utils-${VERSION}-${RELEASE}.deb
ar r ${DEB} ${BUILD_ROOT}/debian-binary
ar r ${DEB} ${BUILD_ROOT}/control.tar.gz
ar r ${DEB} ${BUILD_ROOT}/data.tar.gz
......
......@@ -7,5 +7,5 @@
#
[global]
version=1.26
release=3
version=1.27.1
release=1
Package: amazon-efs-utils
Architecture: all
Version: 1.26.3
Version: 1.27.1
Section: utils
Depends: python|python2, nfs-common, stunnel4 (>= 4.56), openssl (>= 1.0.2), util-linux
Priority: optional
......
......@@ -70,7 +70,7 @@ except ImportError:
from urllib.parse import urlencode
VERSION = '1.26.3'
VERSION = '1.27.1'
SERVICE = 'elasticfilesystem'
CONFIG_FILE = '/etc/amazon/efs/efs-utils.conf'
......@@ -1571,7 +1571,7 @@ def is_nfs_mount(mountpoint):
def mount_tls(config, init_system, dns_name, path, fs_id, mountpoint, options):
if os.path.ismount(mountpoint) and is_nfs_mount(mountpoint):
sys.stdout.write("%s is already mounted, please run 'mount' command to verify\n" % mountpoint)
logging.warn("%s is already mounted, mount aborted" % mountpoint)
logging.warning("%s is already mounted, mount aborted" % mountpoint)
return
with bootstrap_tls(config, init_system, dns_name, fs_id, mountpoint, options) as tunnel_proc:
......
......@@ -47,7 +47,7 @@ except ImportError:
from urllib.request import urlopen, Request
from urllib.parse import urlencode
VERSION = '1.26.3'
VERSION = '1.27.1'
SERVICE = 'elasticfilesystem'
CONFIG_FILE = '/etc/amazon/efs/efs-utils.conf'
......
......@@ -14,45 +14,45 @@ except ImportError:
from configparser import ConfigParser
SPEC_FILE = 'dist/amazon-efs-utils.spec'
NON_SPEC_FILE_LIST = ['build-deb.sh', 'src/watchdog/__init__.py', 'src/mount_efs/__init__.py',
'dist/amazon-efs-utils.control', 'build-deb.sh']
SPEC_FILE = 'amazon-efs-utils.spec'
DEB_FILE = 'build-deb.sh'
FILE_LIST = ['build-deb.sh', 'src/watchdog/__init__.py', 'src/mount_efs/__init__.py',
'dist/amazon-efs-utils.control', 'build-deb.sh', 'amazon-efs-utils.spec']
GLOBAL_CONFIG = 'config.ini'
def test_spec_file_version_release_match():
global_version = get_global_value('version')
global_release = get_global_value('release')
version_in_spec_file = get_version_for_file(SPEC_FILE)
release_in_spec_file = get_release_for_file(SPEC_FILE)
assert version_in_spec_file == global_version, \
'version in {} is {}, does not match global version {}'.format(SPEC_FILE, version_in_spec_file, global_version)
assert release_in_spec_file == global_release, \
'release in {} is {}, does not match global release {}'.format(SPEC_FILE, release_in_spec_file, global_release)
def test_file_version_match():
global_version = get_global_version()
for f in FILE_LIST:
version_in_file = get_version_for_file(f)
assert version_in_file == global_version, 'version in {} is {}, does not match global version {}'\
.format(f, version_in_file, global_version)
def test_non_spec_file_version_release_match():
global_version_release = get_expected_version_release()
for f in NON_SPEC_FILE_LIST:
version_release_in_file = get_version_for_file(f)
assert version_release_in_file == global_version_release, 'version-release in {} is {}, does not match global version {}'\
.format(f, version_release_in_file, global_version_release)
def test_file_release_match():
global_release = get_global_release()
for f in [DEB_FILE, SPEC_FILE]:
release_in_file = get_release_for_file(f)
assert release_in_file == global_release, 'release in {} is {}, does not match global release {}'\
.format(f, release_in_file, global_release)
def test_changelog_version_match():
expected_version_release = get_expected_version_release()
global_version = get_global_version()
version_release_in_changelog = get_version_for_changelog(SPEC_FILE)
assert version_release_in_changelog is not None and version_release_in_changelog == expected_version_release, \
version_in_changelog = get_version_for_changelog(SPEC_FILE)
assert version_in_changelog is not None and version_in_changelog == global_version, \
'version in {} is {}, does not match expected_version_release {}, you need to add changelog in the spec file'\
.format(SPEC_FILE, version_release_in_changelog, expected_version_release)
.format(SPEC_FILE, version_in_changelog, global_version)
def get_expected_version_release():
global_version = get_global_value('version')
global_release = get_global_value('release')
return global_version + '.' + global_release
def get_global_version():
return get_global_value('version')
def get_global_release():
return get_global_value('release')
def get_version_for_changelog(file_path):
......@@ -88,6 +88,8 @@ def get_release_for_file(file_path):
with open(file_to_check) as fp:
lines = fp.readlines()
for line in lines:
if line.startswith('RELEASE'):
return line.split('=')[1].strip()
if line.startswith('Release'):
return line.split(':')[1].strip().split('%')[0]
return None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment