Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.9] feat: enabled s2i for python (#1562) #1579

Merged
merged 2 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test-e2e-oncluster-runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: imjasonh/setup-ko@v0.6
- name: Install Binaries
run: ./hack/binaries.sh
- name: Setup testing func image
run: ./hack/create-testing-func-image.sh
- name: Allocate Cluster
run: ./hack/allocate.sh
- name: Deploy Tekton
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-e2e-oncluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: imjasonh/setup-ko@v0.6
- name: Install Binaries
run: ./hack/binaries.sh
- name: Setup testing func image
run: ./hack/create-testing-func-image.sh
- name: Allocate Cluster
run: ./hack/allocate.sh
- name: Deploy Tekton
Expand Down
15 changes: 15 additions & 0 deletions hack/create-testing-func-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

KO_DOCKER_REPO="ttl.sh/$(head -c 128 </dev/urandom | LC_CTYPE=C tr -dc 'a-z0-9' | fold -w 8 | head -n 1)"
export KO_DOCKER_REPO

REF_FILE=$(mktemp)

ko build --image-refs "${REF_FILE}" --tags "30m" -B ./cmd/func

yq -Y -i ".spec.steps[0].image = \"$(cat "${REF_FILE}")\"" \
pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml
22 changes: 11 additions & 11 deletions pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ spec:
description: >-
This Task performs a deploy operation using the Knative `func` CLI
params:
- name: path
description: Path to the function project
default: ""
- name: image
description: Container image to be deployed
default: ""
- name: path
description: Path to the function project
default: ""
- name: image
description: Container image to be deployed
default: ""
workspaces:
- name: source
description: The workspace containing the function project
steps:
- name: func-deploy
image: "ghcr.io/knative/func/func:latest"
script: |
export FUNC_IMAGE="$(params.image)"
func deploy --verbose --build=false --push=false --path=$(params.path) --remote=false
- name: func-deploy
image: "ghcr.io/knative/func/func:latest"
script: |
export FUNC_IMAGE="$(params.image)"
func deploy --verbose --build=false --push=false --path=$(params.path) --remote=false
1 change: 1 addition & 0 deletions s2i/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var DefaultBuilderImages = map[string]string{
"nodejs": "registry.access.redhat.com/ubi8/nodejs-16",
"typescript": "registry.access.redhat.com/ubi8/nodejs-16",
"quarkus": "registry.access.redhat.com/ubi8/openjdk-17",
"python": "registry.access.redhat.com/ubi8/python-39",
}

// DockerClient is subset of dockerClient.CommonAPIClient required by this package
Expand Down
4 changes: 2 additions & 2 deletions s2i/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func Test_BuildImages(t *testing.T) {
wantErr: true,
},
{
name: "Without builder - unsupported runtime - python",
name: "Without builder - supported runtime - python",
function: fn.Function{Runtime: "python"},
wantErr: true,
wantErr: false,
},
{
name: "Without builder - unsupported runtime - rust",
Expand Down
3 changes: 3 additions & 0 deletions templates/python/cloudevents/app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exec python -m parliament "$(dirname "$0")"
3 changes: 3 additions & 0 deletions templates/python/http/app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exec python -m parliament "$(dirname "$0")"
2 changes: 1 addition & 1 deletion test/oncluster/scenario_runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
var runtimeSupportMap = map[string][]string{
"node": {"pack", "s2i"},
"go": {},
"python": {"pack"},
"python": {"pack", "s2i"},
"quarkus": {"pack", "s2i"},
"springboot": {"pack"},
"typescript": {"pack", "s2i"},
Expand Down
16,807 changes: 8,410 additions & 8,397 deletions zz_filesystem_generated.go

Large diffs are not rendered by default.