Skip to content

Commit 8b19df6

Browse files
committed
📂 update OpenShift specific files
1 parent c6548e6 commit 8b19df6

23 files changed

+9480
-8509
lines changed

.github/workflows/test-e2e-oncluster-runtime.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
run: ./hack/allocate.sh
2222
- name: Setup testing images
2323
run: ./hack/setup-testing-images.sh
24+
- name: Install RH pull secrets for KinD cluster
25+
env:
26+
RH_REG_USR: ${{ secrets.RH_REG_USR }}
27+
RH_REG_PWD: ${{ secrets.RH_REG_PWD }}
28+
run: ./hack/install-pull-secrets.sh
2429
- name: Deploy Tekton
2530
run: ./hack/tekton.sh
2631
- name: Deploy Test Git Server

.github/workflows/test-e2e-oncluster.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ jobs:
1919
run: ./hack/allocate.sh
2020
- name: Setup testing images
2121
run: ./hack/setup-testing-images.sh
22+
- name: Install RH pull secrets for KinD cluster
23+
env:
24+
RH_REG_USR: ${{ secrets.RH_REG_USR }}
25+
RH_REG_PWD: ${{ secrets.RH_REG_PWD }}
26+
run: ./hack/install-pull-secrets.sh
2227
- name: Deploy Tekton
2328
run: ./hack/tekton.sh
2429
- name: Deploy Test Git Server

generate/zz_filesystem_generated.go

+8,501-8,494
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hack/install-pull-secrets.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
main() {
8+
local -r tmp_docker_config="$(mktemp config.json-XXXXXXXX)"
9+
10+
cat <<EOF > "${tmp_docker_config}"
11+
{
12+
"auths": {
13+
"registry.redhat.io": {
14+
"auth": "$(echo -n "${RH_REG_USR}:${RH_REG_PWD}" | base64 -w0)"
15+
}
16+
}
17+
}
18+
EOF
19+
20+
local node
21+
for node in $(kind get nodes --name "func"); do
22+
tar -cf - "${tmp_docker_config}" --transform="flags=r;s|${tmp_docker_config}|config.json|" | \
23+
docker cp - "${node}:/var/lib/kubelet/"
24+
done
25+
rm "${tmp_docker_config}"
26+
}
27+
28+
main "$@"

hack/openshift-pipelines.sh

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2022 The OpenShift Knative Authors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
# source of tasks (in this case to the project root folder)
22+
source_path=$(dirname $(cd $(dirname $0) && pwd ))
23+
24+
openshift_pipelines() {
25+
echo "Installing Openshift Pipelines..."
26+
27+
PIPELINE_OPERATOR_DEFAULT_CHANNEL=$(oc get packagemanifests openshift-pipelines-operator-rh -n openshift-marketplace -o json | jq '.status.defaultChannel' | tr -d '"')
28+
PIPELINE_OPERATOR_CHANNEL=${PIPELINE_OPERATOR_CHANNEL:-${PIPELINE_OPERATOR_DEFAULT_CHANNEL}}
29+
PIPELINE_TARGET_VERSION=$(oc get packagemanifests openshift-pipelines-operator-rh -n openshift-marketplace -o json | CHANNEL=$PIPELINE_OPERATOR_CHANNEL jq '.status.channels[] | select(.name==env.CHANNEL) | .currentCSV')
30+
31+
echo Channel: $PIPELINE_OPERATOR_CHANNEL Target Version: $PIPELINE_TARGET_VERSION
32+
33+
cat << EOF | oc apply -f -
34+
apiVersion: operators.coreos.com/v1alpha1
35+
kind: Subscription
36+
metadata:
37+
name: openshift-pipelines-operator-rh
38+
namespace: openshift-operators
39+
spec:
40+
channel: $PIPELINE_OPERATOR_CHANNEL
41+
name: openshift-pipelines-operator-rh
42+
source: redhat-operators
43+
sourceNamespace: openshift-marketplace
44+
EOF
45+
46+
}
47+
48+
wait_pipelines_ready() {
49+
echo "Waiting for Openshift Pipeline to get ready..."
50+
rc=1
51+
set +e
52+
for i in $(seq 5); do
53+
oc wait subscription.operators.coreos.com/openshift-pipelines-operator-rh -n openshift-operators --for=jsonpath='{.status.state}'="AtLatestKnown" --timeout=60s && \
54+
oc wait pod --for=condition=Ready --timeout=180s -n openshift-pipelines -l "app=tekton-pipelines-controller" && \
55+
oc wait pod --for=condition=Ready --timeout=180s -n openshift-pipelines -l "app=tekton-pipelines-webhook" && \
56+
rc=0 && break || (echo "Conditions are not matched. Retrying in 10 secs" && sleep 10)
57+
done
58+
set -e
59+
if (( $rc )); then
60+
echo "Installing Openshift pipelines has failed"
61+
exit 1
62+
fi
63+
}
64+
65+
tekton_tasks() {
66+
echo "Creating Pipeline tasks..."
67+
oc apply -f ${source_path}/pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml
68+
oc apply -f ${source_path}/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
69+
oc apply -f ${source_path}/pkg/pipelines/resources/tekton/task/func-buildpacks/0.1/func-buildpacks.yaml
70+
}
71+
72+
tasks_only=false
73+
if [[ $# -ge 1 && "$1" == "--tasks-only" ]]; then
74+
tasks_only=true
75+
elif [[ $# -ge 1 ]]; then
76+
echo "Unknown parameters, use '--tasks-only' to only install Tekton Tasks"
77+
fi
78+
79+
if [ $tasks_only = false ] ; then
80+
openshift_pipelines
81+
wait_pipelines_ready
82+
fi
83+
tekton_tasks
84+
85+
echo Done
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/pkg/builders/builders.go b/pkg/builders/builders.go
2+
index e172834c..44d00311 100644
3+
--- a/pkg/builders/builders.go
4+
+++ b/pkg/builders/builders.go
5+
@@ -16,7 +16,7 @@ const (
6+
Host = "host"
7+
Pack = "pack"
8+
S2I = "s2i"
9+
- Default = Pack
10+
+ Default = S2I
11+
)
12+
13+
// Known builder names with a pretty-printed string representation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
diff --git a/pkg/pipelines/resources/tekton/task/func-buildpacks/0.1/func-buildpacks.yaml b/pkg/pipelines/resources/tekton/task/func-buildpacks/0.1/func-buildpacks.yaml
2+
index ee227cf7..ac42d639 100644
3+
--- a/pkg/pipelines/resources/tekton/task/func-buildpacks/0.1/func-buildpacks.yaml
4+
+++ b/pkg/pipelines/resources/tekton/task/func-buildpacks/0.1/func-buildpacks.yaml
5+
@@ -1,6 +1,6 @@
6+
---
7+
apiVersion: tekton.dev/v1beta1
8+
-kind: Task
9+
+kind: ClusterTask
10+
metadata:
11+
name: func-buildpacks
12+
labels:
13+
diff --git a/pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml b/pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml
14+
index c58ff568..4658f04f 100644
15+
--- a/pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml
16+
+++ b/pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml
17+
@@ -1,5 +1,5 @@
18+
apiVersion: tekton.dev/v1beta1
19+
-kind: Task
20+
+kind: ClusterTask
21+
metadata:
22+
name: func-deploy
23+
labels:
24+
diff --git a/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml b/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
25+
index bf90adfa..7f9fe8fc 100644
26+
--- a/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
27+
+++ b/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
28+
@@ -1,5 +1,5 @@
29+
apiVersion: tekton.dev/v1beta1
30+
-kind: Task
31+
+kind: ClusterTask
32+
metadata:
33+
name: func-s2i
34+
labels:
35+
@@ -26,6 +26,7 @@ spec:
36+
description: Reference of the image S2I will produce.
37+
- name: REGISTRY
38+
description: The registry associated with the function image.
39+
+ default: ""
40+
- name: PATH_CONTEXT
41+
description: The location of the path to run s2i from.
42+
default: .
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml b/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
2+
index 696699580..7c25d5b67 100644
3+
--- a/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
4+
+++ b/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
5+
@@ -60,7 +60,7 @@ spec:
6+
description: Digest of the image just built.
7+
steps:
8+
- name: generate
9+
- image: quay.io/boson/s2i:latest
10+
+ image: registry.redhat.io/ocp-tools-4-tech-preview/source-to-image-rhel8@sha256:98d8cb3a255641ca6a1bce854e5e2460c20de9fb9b28e3cc67eb459f122873dd
11+
workingDir: $(workspaces.source.path)
12+
args: ["$(params.ENV_VARS[*])"]
13+
script: |
14+
@@ -99,7 +99,7 @@ spec:
15+
- mountPath: /env-vars
16+
name: env-vars
17+
- name: build
18+
- image: quay.io/buildah/stable:v1.31.0
19+
+ image: registry.redhat.io/rhel8/buildah@sha256:a1e5cc0fb334e333e5eab69689223e8bd1f0c060810d260603b26cf8c0da2023
20+
workingDir: /gen-source
21+
script: |
22+
TLS_VERIFY_FLAG=""
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
diff --git a/.github/workflows/test-e2e-oncluster-runtime.yaml b/.github/workflows/test-e2e-oncluster-runtime.yaml
2+
index db0c221e..9c3995ff 100644
3+
--- a/.github/workflows/test-e2e-oncluster-runtime.yaml
4+
+++ b/.github/workflows/test-e2e-oncluster-runtime.yaml
5+
@@ -22,6 +22,11 @@ jobs:
6+
run: ./hack/allocate.sh
7+
- name: Setup testing images
8+
run: ./hack/setup-testing-images.sh
9+
+ - name: Install RH pull secrets for KinD cluster
10+
+ env:
11+
+ RH_REG_USR: ${{ secrets.RH_REG_USR }}
12+
+ RH_REG_PWD: ${{ secrets.RH_REG_PWD }}
13+
+ run: ./hack/install-pull-secrets.sh
14+
- name: Deploy Tekton
15+
run: ./hack/tekton.sh
16+
- name: Deploy Test Git Server
17+
diff --git a/.github/workflows/test-e2e-oncluster.yaml b/.github/workflows/test-e2e-oncluster.yaml
18+
index db4a0436..68a0ad08 100644
19+
--- a/.github/workflows/test-e2e-oncluster.yaml
20+
+++ b/.github/workflows/test-e2e-oncluster.yaml
21+
@@ -22,6 +22,11 @@ jobs:
22+
run: ./hack/allocate.sh
23+
- name: Setup testing images
24+
run: ./hack/setup-testing-images.sh
25+
+ - name: Install RH pull secrets for KinD cluster
26+
+ env:
27+
+ RH_REG_USR: ${{ secrets.RH_REG_USR }}
28+
+ RH_REG_PWD: ${{ secrets.RH_REG_PWD }}
29+
+ run: ./hack/install-pull-secrets.sh
30+
- name: Deploy Tekton
31+
run: ./hack/tekton.sh
32+
- name: Deploy Test Git Server
33+
diff --git a/hack/install-pull-secrets.sh b/hack/install-pull-secrets.sh
34+
new file mode 100755
35+
index 00000000..33ac051c
36+
--- /dev/null
37+
+++ b/hack/install-pull-secrets.sh
38+
@@ -0,0 +1,28 @@
39+
+#!/usr/bin/env bash
40+
+
41+
+set -o errexit
42+
+set -o nounset
43+
+set -o pipefail
44+
+
45+
+main() {
46+
+ local -r tmp_docker_config="$(mktemp config.json-XXXXXXXX)"
47+
+
48+
+ cat <<EOF > "${tmp_docker_config}"
49+
+{
50+
+ "auths": {
51+
+ "registry.redhat.io": {
52+
+ "auth": "$(echo -n "${RH_REG_USR}:${RH_REG_PWD}" | base64 -w0)"
53+
+ }
54+
+ }
55+
+}
56+
+EOF
57+
+
58+
+ local node
59+
+ for node in $(kind get nodes --name "func"); do
60+
+ tar -cf - "${tmp_docker_config}" --transform="flags=r;s|${tmp_docker_config}|config.json|" | \
61+
+ docker cp - "${node}:/var/lib/kubelet/"
62+
+ done
63+
+ rm "${tmp_docker_config}"
64+
+}
65+
+
66+
+main "$@"

openshift/release/update-to-head.sh

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2019 The OpenShift Knative Authors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# The local git repo must have a remote "upstream" pointing
18+
# to knative-sandbox/kn-plugin-func, and a remote "openshift"
19+
# pointing to openshift-knative/kn-plugin-func.
20+
21+
# Synchs the release-next branch to main and then triggers CI
22+
# Usage: update-to-head.sh
23+
24+
set -e
25+
REPO_NAME=$(basename $(git rev-parse --show-toplevel))
26+
27+
# Custom files
28+
custom_files=$(cat <<EOT | tr '\n' ' '
29+
openshift
30+
EOT
31+
)
32+
openshift_files_msg=":open_file_folder: update OpenShift specific files"
33+
robot_trigger_msg=":robot: triggering CI on branch 'release-next' after synching from upstream/main"
34+
35+
# Reset release-next to upstream/main.
36+
git fetch upstream main
37+
git checkout upstream/main -B release-next
38+
39+
# Update openshift's main and take all needed files from there.
40+
git fetch openshift main
41+
git checkout openshift/main $custom_files
42+
43+
# Apply midstream patches
44+
if [[ -d openshift/patches ]]; then
45+
git apply openshift/patches/*
46+
fi
47+
# Apply midstream overrides
48+
if [[ -d openshift/overrides ]]; then
49+
cp -r openshift/overrides/. .
50+
rm -rf openshift/overrides
51+
fi
52+
# Apply midstream patches using scripts
53+
if [[ -d openshift/scripts ]]; then
54+
for script in openshift/scripts/*.sh; do
55+
"$script"
56+
done
57+
fi
58+
git add .
59+
60+
make generate/zz_filesystem_generated.go
61+
git add $custom_files generate/zz_filesystem_generated.go templates/certs/ca-certificates.crt
62+
git commit -m "${openshift_files_msg}"
63+
64+
git push -f openshift release-next
65+
66+
# Trigger CI
67+
git checkout release-next -B release-next-ci
68+
date > ci
69+
git add ci
70+
git commit -m "${robot_trigger_msg}"
71+
git push -f openshift release-next-ci
72+
73+
if hash hub 2>/dev/null; then
74+
# Test if there is already a sync PR in
75+
COUNT=$(hub api -H "Accept: application/vnd.github.v3+json" repos/openshift-knative/${REPO_NAME}/pulls --flat \
76+
| grep -c "${robot_trigger_msg}") || true
77+
if [ "$COUNT" = "0" ]; then
78+
hub pull-request --no-edit -l "kind/sync-fork-to-upstream,approved,lgtm" -b openshift-knative/${REPO_NAME}:release-next -h openshift-knative/${REPO_NAME}:release-next-ci -m "${robot_trigger_msg}"
79+
fi
80+
else
81+
echo "hub (https://github.com/github/hub) is not installed, so you'll need to create a PR manually."
82+
fi

0 commit comments

Comments
 (0)