Skip to content

Commit 50856dc

Browse files
committed
Version 3.0.0
Version 3.0.0 updates
1 parent 6a30bd7 commit 50856dc

33 files changed

+1183
-805
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Contributing Guidelines
22

3-
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
3+
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
44
documentation, we greatly value feedback and contributions from our community.
55

6-
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
6+
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
77
information to effectively respond to your bug report or contribution.
88

99

1010
## Reporting Bugs/Feature Requests
1111

1212
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
1313

14-
When filing an issue, please check [existing open](https://github.com/awslabs/serverless-image-handler/issues), or [recently closed](https://github.com/awslabs/serverless-image-handler/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
14+
When filing an issue, please check [existing open](https://github.com/awslabs/serverless-image-handler/issues), or [recently closed](https://github.com/awslabs/serverless-image-handler/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
1515
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
1616

1717
* A reproducible test case or series of steps
@@ -36,17 +36,17 @@ To send us a pull request, please:
3636
5. Send us a pull request, answering any default questions in the pull request interface.
3737
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
3838

39-
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
39+
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
4040
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
4141

4242

4343
## Finding contributions to work on
44-
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels ((enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/awslabs/serverless-image-handler/labels/help%20wanted) issues is a great place to start.
44+
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels ((enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/awslabs/serverless-image-handler/labels/help%20wanted) issues is a great place to start.
4545

4646

4747
## Code of Conduct
48-
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
49-
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
48+
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
49+
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
5050
[email protected] with any additional questions or comments.
5151

5252

LICENSE.txt

100644100755
File mode changed.

NOTICE.txt

100644100755
File mode changed.

deployment/build-s3-dist.sh

Lines changed: 82 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
#sudo yum-config-manager --enable epel
55
#sudo yum update -y
66
#sudo yum install git libpng-devel libcurl-devel gcc python-devel libjpeg-devel -y
7-
#sudo pip install --upgrade pip
8-
#alias sudo='sudo env PATH=$PATH'
9-
#sudo pip install --upgrade setuptools
10-
#sudo pip install --upgrade virtualenv
11-
7+
# pip install --upgrade pip==9.0.3
8+
# alias sudo='sudo env PATH=$PATH'
9+
# pip install --upgrade setuptools==39.0.1
10+
# pip install --upgrade virtualenv==15.2.0
1211
# This script should be run from the repo's deployment directory
1312
# cd deployment
1413
# ./build-s3-dist.sh source-bucket-base-name
@@ -24,7 +23,7 @@ if [ -z "$1" ]; then
2423
fi
2524

2625
# Build source
27-
echo "Staring to build distribution"
26+
echo "Starting to build distribution"
2827
echo "export deployment_dir=`pwd`"
2928
export deployment_dir=`pwd`
3029
echo "mkdir -p dist"
@@ -35,43 +34,96 @@ echo "Updating code source bucket in template with $1"
3534
replace="s/%%BUCKET_NAME%%/$1/g"
3635
echo "sed -i '' -e $replace dist/serverless-image-handler.template"
3736
sed -i '' -e $replace dist/serverless-image-handler.template
37+
38+
# SO-SIH-154 - 07/16/2018 - Build fixes
39+
# Adding variable for artifact version
40+
replace="s/%%VERSION%%/$2/g"
41+
echo "sed -i '' -e $replace dist/serverless-image-handler.template"
42+
sed -i '' -e $replace dist/serverless-image-handler.template
43+
3844
echo "Creating UI ZIP file"
3945
cd $deployment_dir/../source/ui
4046
zip -q -r9 $deployment_dir/dist/serverless-image-handler-ui.zip *
4147
echo "Building custom resource package ZIP file"
4248
cd $deployment_dir/dist
4349
pwd
44-
echo "virtualenv env"
45-
virtualenv env
50+
echo "virtualenv --no-site-packages env"
51+
virtualenv --no-site-packages env
4652
echo "source env/bin/activate"
4753
source env/bin/activate
48-
echo "pip install $deployment_dir/../source/image-handler-custom-resource/. --target=$deployment_dir/dist/env/lib/python2.7/site-packages/"
49-
pip install $deployment_dir/../source/image-handler-custom-resource/. --target=$deployment_dir/dist/env/lib/python2.7/site-packages/
54+
echo "python -m pip install pip==9.0.3"
55+
python -m pip install pip==9.0.3
56+
# SO-SIH-157 - 07/17/2018 - Pip version
57+
# Checking pip version inside virtualenv for debugging
58+
echo "which python pip virtualenv, version"
59+
which python && python --version
60+
which pip && pip --version
61+
which virtualenv && virtualenv --version
62+
63+
# Building custom resource zip
64+
echo "pip install -q $deployment_dir/../source/image-handler-custom-resource/. --target=$deployment_dir/dist/env/lib/python2.7/site-packages/"
65+
pip install -q $deployment_dir/../source/image-handler-custom-resource/. --target=$deployment_dir/dist/env/lib/python2.7/site-packages/
5066
cd $deployment_dir/dist/env/lib/python2.7/site-packages/
5167
zip -r9 $deployment_dir/dist/serverless-image-handler-custom-resource.zip *
5268
cd $deployment_dir/dist
5369
zip -q -d serverless-image-handler-custom-resource.zip pip*
5470
zip -q -d serverless-image-handler-custom-resource.zip easy*
5571
rm -rf env
72+
73+
# Building image handler zip
5674
echo "Building Image Handler package ZIP file"
5775
cd $deployment_dir/dist
5876
pwd
59-
echo "virtualenv env"
60-
virtualenv env
77+
echo "virtualenv --no-site-packages env"
78+
virtualenv --no-site-packages env
6179
echo "source env/bin/activate"
6280
source env/bin/activate
81+
echo "python -m pip install pip==9.0.3"
82+
python -m pip install pip==9.0.3
83+
echo "which python pip virtualenv, version"
84+
which python && python --version
85+
which pip && pip --version
86+
which virtualenv && virtualenv --version
87+
6388
cd ../..
6489
pwd
90+
91+
# SO-SIH-159 - 07/25/2018 - Pycurl ssl backend
92+
# Configuring compile time ssl backend
93+
# https://stackoverflow.com/questions/21096436/ssl-backend-error-when-using-openssl
94+
export PYCURL_SSL_LIBRARY=nss
95+
96+
# to help with debugging
97+
echo "which curl && curl --version"
98+
which curl && curl --version
99+
echo "which curl-config && curl-config --version"
100+
which curl-config && curl-config --version
101+
102+
cd $VIRTUAL_ENV
103+
pwd
104+
105+
# SO-SIH-159 - 07/25/2018 - Curl 7.51.0
106+
# Installing curl 7.51.0 to keep libcurl link-time and compile-time version same
107+
# Building pycurl against libcurl 7.51.0 resolves the issue
108+
echo "installing curl 7.51.0"
109+
wget https://curl.haxx.se/download/curl-7.51.0.tar.gz
110+
tar -zxvf curl-7.51.0.tar.gz
111+
cd curl-7.51.0
112+
./configure
113+
make
114+
make install
115+
which curl && curl --version
116+
which curl-config && curl-config --version
117+
118+
cd $VIRTUAL_ENV
119+
cd ../../..
120+
pwd
65121
echo "pip install source/image-handler/. --target=$VIRTUAL_ENV/lib/python2.7/site-packages/"
66122
pip install source/image-handler/. --target=$VIRTUAL_ENV/lib/python2.7/site-packages/
67-
echo "pip install -r source/image-handler/requirements.txt --target=$VIRTUAL_ENV/lib/python2.7/site-packages/"
68-
pip install -r source/image-handler/requirements.txt --target=$VIRTUAL_ENV/lib/python2.7/site-packages/
123+
69124
cd $VIRTUAL_ENV
70-
pwd
71-
#building pngquant
72-
echo "cp pngquant $VIRTUAL_ENV"
73-
cp -f pngquant $VIRTUAL_ENV
74-
#installing optipng pngcrush gifsicle jpegtran
125+
126+
#installing optipng pngcrush gifsicle pngquant jpegtran
75127
echo "yum install optipng pngcrush gifsicle libjpeg* pngquant ImageMagick-devel -y"
76128
yum install optipng pngcrush gifsicle libjpeg* pngquant ImageMagick-devel -y
77129
mkdir $VIRTUAL_ENV/bin/lib
@@ -81,24 +133,28 @@ cp -f /usr/bin/pngcrush $VIRTUAL_ENV
81133
cp -f /usr/bin/gifsicle $VIRTUAL_ENV
82134
cp -f /usr/bin/pngquant $VIRTUAL_ENV
83135
cp -f /usr/lib64/libimagequant.so* $VIRTUAL_ENV/bin/lib
136+
84137
#building mozjpeg
85138
cd $VIRTUAL_ENV
86139
pwd
87140
echo 'yum install nasm autoconf automake libtool -y'
88141
yum install nasm autoconf automake libtool -y
89142
echo 'wget https://github.com/mozilla/mozjpeg/releases/download/v3.2/mozjpeg-3.2-release-source.tar.gz'
90143
wget https://github.com/mozilla/mozjpeg/releases/download/v3.2/mozjpeg-3.2-release-source.tar.gz
91-
tar -zxvf mozjpeg-3.2-release-source.tar.gz
92-
cd mozjpeg
144+
tar -zxvf mozjpeg-3.2-release-source.tar.gz
145+
cd mozjpeg
93146
autoreconf -fiv
94147
mkdir build && cd build
95-
sh ../configure
148+
sh ../configure --disable-shared --enable-static
96149
make install prefix=/var/task libdir=/var/task
97150
cp -f /var/task/libjpeg.so* $VIRTUAL_ENV/bin/lib
98-
cp -f /var/task/bin/jpegtran $VIRTUAL_ENV/mozjpeg
151+
# SO-SIH-170 - 08/15/2018 - mozjpeg path
152+
# mozjpeg executable becomes cjpeg, rectifying path
153+
echo "cp -f /var/task/bin/cjpeg $VIRTUAL_ENV"
154+
cp -f /var/task/bin/cjpeg $VIRTUAL_ENV
99155
#building imgmin
100156
cd $VIRTUAL_ENV
101-
pwd
157+
pwd
102158
echo 'git clone https://github.com/rflynn/imgmin.git'
103159
git clone https://github.com/rflynn/imgmin.git
104160
cd imgmin
@@ -133,8 +189,8 @@ echo "zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip pngcrush"
133189
zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip pngcrush
134190
echo "zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip gifsicle"
135191
zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip gifsicle
136-
echo "zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip mozjpeg"
137-
zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip mozjpeg
192+
echo "zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip mozjpeg/cjpeg"
193+
zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip cjpeg
138194
echo "zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip imgmin"
139195
zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip imgmin
140196
cd $VIRTUAL_ENV/bin

deployment/run-unit-tests.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/bash
2+
# This assumes all of the OS-level configuration has been completed and git repo has already been cloned
3+
#sudo yum-config-manager --enable epel
4+
#sudo yum update -y
5+
#sudo yum install git libpng-devel libcurl-devel gcc python-devel libjpeg-devel -y
6+
# pip install --upgrade pip==9.0.3
7+
# alias sudo='sudo env PATH=$PATH'
8+
# pip install --upgrade setuptools==39.0.1
9+
# pip install --upgrade virtualenv==15.2.0
10+
11+
# This script should be run from the repo's deployment directory
12+
# cd deployment
13+
# ./run-unit-tests.sh
14+
15+
# Test source
16+
echo "Staring to test distribution"
17+
echo "export deployment_dir=`pwd`"
18+
export deployment_dir=`pwd`
19+
echo "mkdir -p test"
20+
mkdir -p test
21+
cd $deployment_dir/test
22+
pwd
23+
# SIM - 07/31/2018 - Fix in class import
24+
# The test.test_support module seems to be missing from 2.7.14.
25+
# Module is needed for unit tests, compiling 2.7.15
26+
# https://docs.python.org/2/library/test.html
27+
wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
28+
tar xzf Python-2.7.15.tgz
29+
cd Python-2.7.15
30+
./configure --enable-optimizations
31+
make altinstall
32+
cd ..
33+
34+
echo "virtualenv --python=/usr/local/bin/python2.7 --no-site-packages testenv"
35+
virtualenv --python=/usr/local/bin/python2.7 --no-site-packages testenv
36+
echo "source testenv/bin/activate"
37+
source testenv/bin/activate
38+
pip install pip==9.0.3
39+
cd ../..
40+
pwd
41+
42+
# SO-SIH-157 - 07/17/2018 - Pip version
43+
# Checking python, pip version inside virtualenv
44+
echo "python --version"
45+
python --version
46+
echo "pip --version"
47+
pip --version
48+
echo "virtualenv --version"
49+
virtualenv --version
50+
51+
echo "pip install source/image-handler/. --target=$VIRTUAL_ENV/lib/python2.7/site-packages/"
52+
pip install source/image-handler/. --target=$VIRTUAL_ENV/lib/python2.7/site-packages/
53+
echo "pip install mock pytest"
54+
# SIM - 07/31/2018 - Locking dependency version
55+
# Locking to mock==2.0.0 pytest==3.5.0
56+
pip install mock==2.0.0 pytest==3.5.0
57+
echo "pytest source/image-handler"
58+
pytest source/image-handler/
59+
retval=$?
60+
if [ $retval -eq 0 ] ; then
61+
echo "All tests were successful"
62+
else
63+
echo "Tests failed"
64+
exit 1
65+
66+
fi
67+
echo "Clean up test material"
68+
echo "remove virtualenv"
69+
deactivate
70+
rm -rf $VIRTUAL_ENV
71+
rm -rf $deployment_dir/test
72+
pwd
73+
rm -rf source/image-handler/tests/__pycache__
74+
rm -rf source/image-handler/.pytest_cache
75+
rm source/image-handler/tests/*.pyc
76+
echo "Completed testing distribution"

0 commit comments

Comments
 (0)