Skip to content

Commit 772963d

Browse files
authored
Merge pull request #115 from metamemelord/3.x-version-bump
Bumped Python version of runtime and CI
2 parents 95e2ca5 + 13c7f2d commit 772963d

10 files changed

Lines changed: 167 additions & 7 deletions

File tree

.circleci/config.yml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ orbs:
44
jobs:
55
"test":
66
docker:
7-
- image: circleci/python:3.8.5
7+
- image: circleci/python:3.8
88
working_directory: ~/fdk-python
99
steps:
1010
- checkout
@@ -34,7 +34,7 @@ jobs:
3434
tox -epy3.8
3535
"deploy":
3636
docker:
37-
- image: circleci/python:3.8.5
37+
- image: circleci/python:3.8
3838
working_directory: ~/fdk-python
3939
steps:
4040
- checkout
@@ -55,7 +55,9 @@ jobs:
5555
git branch --set-upstream-to=origin/${CIRCLE_BRANCH} ${CIRCLE_BRANCH}
5656
5757
./build-images.sh 3.6
58+
./build-images.sh 3.7
5859
./build-images.sh 3.7.1
60+
./build-images.sh 3.8
5961
./build-images.sh 3.8.5
6062
./release.sh
6163
./release_images.sh
@@ -80,6 +82,25 @@ jobs:
8082
policy_bundle_file_path: .circleci/.anchore/policy_bundle.json
8183
- anchore/parse_reports
8284

85+
"python37_security_check":
86+
executor: anchore/anchore_engine
87+
working_directory: ~/fdk-python
88+
steps:
89+
- setup_remote_docker:
90+
docker_layer_caching: false
91+
- checkout
92+
- run:
93+
name: Python 3.7 build
94+
command: |
95+
apk add bash
96+
./build-images.sh 3.7
97+
- anchore/analyze_local_image:
98+
image_name: "fnproject/python:3.7-dev fnproject/python:3.7"
99+
timeout: '500'
100+
policy_failure: true
101+
policy_bundle_file_path: .circleci/.anchore/policy_bundle.json
102+
- anchore/parse_reports
103+
83104
"python371_security_check":
84105
executor: anchore/anchore_engine
85106
working_directory: ~/fdk-python
@@ -99,6 +120,25 @@ jobs:
99120
policy_bundle_file_path: .circleci/.anchore/policy_bundle.json
100121
- anchore/parse_reports
101122

123+
"python38_security_check":
124+
executor: anchore/anchore_engine
125+
working_directory: ~/fdk-python
126+
steps:
127+
- setup_remote_docker:
128+
docker_layer_caching: false
129+
- checkout
130+
- run:
131+
name: Python 3.8 build
132+
command: |
133+
apk add bash
134+
./build-images.sh 3.8
135+
- anchore/analyze_local_image:
136+
image_name: "fnproject/python:3.8-dev fnproject/python:3.8"
137+
timeout: '500'
138+
policy_failure: true
139+
policy_bundle_file_path: .circleci/.anchore/policy_bundle.json
140+
- anchore/parse_reports
141+
102142
"python385_security_check":
103143
executor: anchore/anchore_engine
104144
working_directory: ~/fdk-python
@@ -137,5 +177,7 @@ workflows:
137177
- master
138178
jobs:
139179
- "python36_security_check"
180+
- "python37_security_check"
140181
- "python371_security_check"
182+
- "python38_security_check"
141183
- "python385_security_check"

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,12 @@ curl -v -X POST localhost:5001 -d '{"name":"denis"}'
321321

322322
First of all create a test function:
323323
```bash
324-
fn init --runtime python3.8.5 test-function
324+
fn init --runtime python3.8 test-function
325325
```
326326

327327
Create a Dockerfile in a function's folder:
328328
```dockerfile
329-
FROM fnproject/python:3.8.5-dev as build-stage
329+
FROM fnproject/python:3.8-dev as build-stage
330330

331331
ADD . /function
332332
WORKDIR /function
@@ -335,7 +335,7 @@ RUN pip3 install --target /python/ --no-cache --no-cache-dir fdk-test-py3-none-
335335

336336
RUN rm -fr ~/.cache/pip /tmp* requirements.txt func.yaml Dockerfile .venv
337337

338-
FROM fnproject/python:3.8.5
338+
FROM fnproject/python:3.8
339339

340340
COPY --from=build-stage /function /function
341341
COPY --from=build-stage /python /python
@@ -413,7 +413,7 @@ except ValueError as ex:
413413
### Dockerfile
414414
If you've been using CLI to build function without modifying runtime in `func.yaml` to `docker`
415415
instead of `python` then the only thing you need is to update the CLI to the latest version and
416-
pin your Python runtime version to `python`, `python3.7.1`, or `python3.8.5`.
416+
pin your Python runtime version to `python`, `python3.7`, or `python3.8`.
417417

418418
If you've been using custom multi-stage Dockerfile (derived from what Fn CLI generates)
419419
the only thing that is necessary to change is an `ENTRYPOINT` from:

build-images.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818

1919
set -xe
2020

21-
pyversion=${1:-"3.8.5"}
21+
if [ -z "$1" ];then
22+
echo "Please supply python version as argument to build image." >> /dev/stderr
23+
exit 2
24+
fi
25+
26+
pyversion=$1
2227

2328
pushd images/build-stage/${pyversion} && docker build -t fnproject/python:${pyversion}-dev . && popd
2429
pushd images/runtime/${pyversion} && docker build -t fnproject/python:${pyversion} . && popd

images/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,21 @@ pushd build-stage/3.7.1; docker build -t fnproject/python:3.7.1-dev .; popd
1212
pushd runtime/3.7.1; docker build -t fnproject/python:3.7.1 .; popd
1313
```
1414

15+
```sh
16+
pushd build-stage/3.7; docker build -t fnproject/python:3.7-dev .; popd
17+
pushd runtime/3.7; docker build -t fnproject/python:3.7 .; popd
18+
```
19+
1520
```sh
1621
pushd build-stage/3.8.5; docker build -t fnproject/python:3.8.5-dev .; popd
1722
pushd runtime/3.8.5; docker build -t fnproject/python:3.8.5 .; popd
1823
```
1924

25+
```sh
26+
pushd build-stage/3.8; docker build -t fnproject/python:3.8-dev .; popd
27+
pushd runtime/3.8; docker build -t fnproject/python:3.8 .; popd
28+
```
29+
2030
Then push:
2131

2232
```sh
@@ -29,7 +39,17 @@ docker push fnproject/python:3.7.1-dev
2939
docker push fnproject/python:3.7.1
3040
```
3141

42+
```sh
43+
docker push fnproject/python:3.7-dev
44+
docker push fnproject/python:3.7
45+
```
46+
3247
```sh
3348
docker push fnproject/python:3.8.5-dev
3449
docker push fnproject/python:3.8.5
50+
```
51+
52+
```sh
53+
docker push fnproject/python:3.8-dev
54+
docker push fnproject/python:3.8
3555
```

images/build-stage/3.7/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
FROM python:3.7-slim
18+
19+
RUN apt-get update && apt-get upgrade -qy && \
20+
apt-get install --no-install-recommends -qy build-essential gcc && \
21+
apt-get clean

images/build-stage/3.8/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
FROM python:3.8-slim
18+
19+
RUN apt-get update && apt-get upgrade -qy && \
20+
apt-get install --no-install-recommends -qy build-essential gcc && \
21+
apt-get clean

images/runtime/3.7/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
FROM python:3.7-slim
18+
19+
20+
RUN apt-get update && apt-get upgrade -qy && apt-get clean
21+
RUN addgroup --system --gid 1000 --system fn && adduser --system --uid 1000 --ingroup fn fn

images/runtime/3.8/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
FROM python:3.8-slim
18+
19+
RUN apt-get update && apt-get upgrade -qy && apt-get clean
20+
RUN addgroup --system --gid 1000 fn && adduser --system --uid 1000 --ingroup fn fn

release_images.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ runtime371="3.7.1"
2727
docker push ${user}/${image}:${runtime371}
2828
docker push ${user}/${image}:${runtime371}-dev
2929

30+
runtime37="3.7"
31+
docker push ${user}/${image}:${runtime37}
32+
docker push ${user}/${image}:${runtime37}-dev
33+
3034
runtime385="3.8.5"
3135
docker push ${user}/${image}:${runtime385}
3236
docker push ${user}/${image}:${runtime385}-dev
37+
38+
runtime38="3.8"
39+
docker push ${user}/${image}:${runtime38}
40+
docker push ${user}/${image}:${runtime38}-dev

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ summary = Function Developer Kit for Python
44
description =
55
README.md
66
description_content_type = text/markdown; charset=UTF-8; variant=GFM
7+
license = Apache License 2.0
8+
license_files = LICENSE, THIRD_PARTY_LICENSES.txt
79
author = Denis Makogon
810
author-email = denys.makogon@oracle.com
911
home-page = https://fnproject.github.io

0 commit comments

Comments
 (0)