From 2f69a2d4ec0dbfe48f61cfe431215d0024d1c9e5 Mon Sep 17 00:00:00 2001 From: Serverless QE Robot Date: Sat, 25 Jan 2025 19:43:43 -0500 Subject: [PATCH] :open_file_folder: Update openshift specific files. --- Makefile | 76 +++++ OWNERS | 9 +- OWNERS_ALIASES | 144 +--------- openshift/ci-operator/build-image/Dockerfile | 24 ++ .../ci-operator/build-image/kubernetes.repo | 6 + openshift/ci-operator/generate-ci-config.sh | 104 +++++++ .../knative-images/client/Dockerfile | 5 + .../client/Dockerfile.cliartifacts | 19 ++ .../knative-test-images/grpc-ping/Dockerfile | 6 + .../knative-test-images/helloworld/Dockerfile | 6 + .../servingcontainer/Dockerfile | 6 + .../sidecarcontainer/Dockerfile | 6 + openshift/e2e-common.sh | 272 ++++++++++++++++++ openshift/e2e-tests-local.sh | 13 + openshift/e2e-tests-openshift.sh | 31 ++ openshift/patches/001-test-images.patch | 22 ++ openshift/patches/100-ko-baseimage.patch | 11 + openshift/release/README.md | 35 +++ openshift/release/create-release-branch.sh | 58 ++++ openshift/release/mirror-upstream-branches.sh | 41 +++ openshift/release/plugin_register.go | 23 ++ openshift/release/update-to-head.sh | 76 +++++ openshift/serverless/operator-install.yaml | 34 +++ package_cliartifacts.sh | 59 ++++ 24 files changed, 945 insertions(+), 141 deletions(-) create mode 100644 Makefile create mode 100644 openshift/ci-operator/build-image/Dockerfile create mode 100644 openshift/ci-operator/build-image/kubernetes.repo create mode 100755 openshift/ci-operator/generate-ci-config.sh create mode 100644 openshift/ci-operator/knative-images/client/Dockerfile create mode 100644 openshift/ci-operator/knative-images/client/Dockerfile.cliartifacts create mode 100644 openshift/ci-operator/knative-test-images/grpc-ping/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/helloworld/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/servingcontainer/Dockerfile create mode 100644 openshift/ci-operator/knative-test-images/sidecarcontainer/Dockerfile create mode 100755 openshift/e2e-common.sh create mode 100755 openshift/e2e-tests-local.sh create mode 100755 openshift/e2e-tests-openshift.sh create mode 100644 openshift/patches/001-test-images.patch create mode 100644 openshift/patches/100-ko-baseimage.patch create mode 100644 openshift/release/README.md create mode 100755 openshift/release/create-release-branch.sh create mode 100755 openshift/release/mirror-upstream-branches.sh create mode 100644 openshift/release/plugin_register.go create mode 100755 openshift/release/update-to-head.sh create mode 100644 openshift/serverless/operator-install.yaml create mode 100755 package_cliartifacts.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..ef7c8b32f1 --- /dev/null +++ b/Makefile @@ -0,0 +1,76 @@ +#This makefile is used by ci-operator + +# Copyright 2019 The OpenShift Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +CGO_ENABLED=1 +GOOS ?= +GOARCH ?= +TEST_IMAGES=./test/test_images/helloworld knative.dev/serving/test/test_images/grpc-ping knative.dev/serving/test/test_images/multicontainer/servingcontainer knative.dev/serving/test/test_images/multicontainer/sidecarcontainer +TEST= +TEST_IMAGE_TAG ?= latest + +install: build + cp ./kn $(GOPATH)/bin +.PHONY: install + +build: + GOFLAGS='' ./hack/build.sh -f +.PHONY: build + +build-with-platform: + ./hack/build.sh -p $(GOOS) $(GOARCH) +.PHONY: build-with-platform + +build-cross: + GOFLAGS='' ./hack/build.sh -x +.PHONY: build-cross + +build-cross-package: build-cross + GOFLAGS='' ./package_cliartifacts.sh +.PHONY: build-cross-package + +test-install: + GOFLAGS='' go install $(TEST_IMAGES) +.PHONY: test-install + +test-images: + for img in $(TEST_IMAGES); do \ + KO_DOCKER_REPO=$(DOCKER_REPO_OVERRIDE) ko build --tags=$(TEST_IMAGE_TAG) $(KO_FLAGS) -B $$img ; \ + done +.PHONY: test-images + +test-unit: + GOFLAGS='' ./hack/build.sh -t +.PHONY: test-unit + +test-e2e: + GOFLAGS='' ./openshift/e2e-tests-openshift.sh +.PHONY: test-e2e + +# Run make DOCKER_REPO_OVERRIDE= test-e2e-local if test images are available +# in the given repository. Make sure you first build and push them there by running `make test-images`. +# Run make BRANCH= test-e2e-local if test images from the latest CI +# build for this branch should be used. Example: `make BRANCH=knative-v0.17.2 test-e2e-local`. +# If neither DOCKER_REPO_OVERRIDE nor BRANCH are defined the tests will use test images +# from the last nightly build. +# If TEST is defined then only the single test will be run. +test-e2e-local: + ./openshift/e2e-tests-local.sh $(TEST) +.PHONY: test-e2e-local + +# Generate an aggregated knative release yaml file, as well as a CI file with replaced image references +generate-release: + ./openshift/generate.sh +.PHONY: generate-release diff --git a/OWNERS b/OWNERS index 24ec5a423d..7405d1f818 100644 --- a/OWNERS +++ b/OWNERS @@ -1,6 +1,7 @@ +# The OWNERS file is used by prow to automatically merge approved PRs. + approvers: -- client-writers -- technical-oversight-committee -- knative-release-leads +- knative-client-approvers + reviewers: -- client-reviewers +- knative-client-reviewers diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES index ea79700f7c..33d1fb45fb 100644 --- a/OWNERS_ALIASES +++ b/OWNERS_ALIASES @@ -1,142 +1,12 @@ -# This file is auto-generated from peribolos. -# Do not modify this file, instead modify peribolos/knative.yaml - aliases: - client-reviewers: - - itsmurugappan - client-wg-leads: + knative-client-approvers: - dsimansk - rhuss - client-writers: - - dsimansk - - rhuss - - vyasgun - docs-reviewers: - - nainaz - - skonto - docs-writers: - - csantanapr - - skonto - eventing-reviewers: - - Leo6Leo - - aslom - - cali0707 - - creydr - eventing-wg-leads: - - pierDipi - eventing-writers: - - Leo6Leo - - aliok - - cali0707 - - creydr - - lionelvillard - - matzew - - pierDipi - func-reviewers: - - jrangelramos - - nainaz - func-writers: - - gauron99 - - jrangelramos - - lance - - lkingland - - matejvasek - - matzew - - salaboy - functions-wg-leads: - - lkingland - - salaboy - knative-admin: - - aliok - - cardil - - davidhadas - - dprotaso - - dsimansk - - evankanderson - - knative-automation - - knative-prow-releaser-robot - - knative-prow-robot - - knative-prow-updater-robot - - knative-test-reporter-robot - - nainaz - - psschwei - - salaboy - - skonto - - upodroid - knative-release-leads: - - dprotaso - - dsimansk - - skonto - knative-robots: - - knative-automation - - knative-prow-releaser-robot - - knative-prow-robot - - knative-prow-updater-robot - - knative-test-reporter-robot - operations-reviewers: - - aliok - - houshengbo - - matzew - operations-wg-leads: - - houshengbo - operations-writers: - - aliok - - houshengbo - - matzew - productivity-leads: - - cardil - - upodroid - productivity-reviewers: - - evankanderson + - Kaustubh-pande - mgencur - productivity-wg-leads: - - cardil - - upodroid - productivity-writers: - - cardil - - upodroid - security-wg-leads: - - davidhadas - - evankanderson - security-writers: - - davidhadas - - evankanderson - serving-approvers: - - skonto - serving-reviewers: - - skonto - serving-triage: - - skonto - serving-wg-leads: - - dprotaso - serving-writers: - - dprotaso - - skonto - steering-committee: - - aliok - - davidhadas - - dprotaso - - dsimansk - - evankanderson - - nainaz - - psschwei - - salaboy - technical-oversight-committee: - - aliok - - davidhadas - - dprotaso + - pierdipi + - creydr + knative-client-reviewers: - dsimansk - - evankanderson - - nainaz - - psschwei - - salaboy - ux-wg-leads: - - cali0707 - - leo6leo - - mmejia02 - - zainabhusain227 - ux-writers: - - cali0707 - - leo6leo - - mmejia02 - - zainabhusain227 + - rhuss + - Kaustubh-pande diff --git a/openshift/ci-operator/build-image/Dockerfile b/openshift/ci-operator/build-image/Dockerfile new file mode 100644 index 0000000000..24b7831c34 --- /dev/null +++ b/openshift/ci-operator/build-image/Dockerfile @@ -0,0 +1,24 @@ +# Copyright 2019 The OpenShift Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Dockerfile to bootstrap build and test in openshift-ci +FROM registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.22-openshift-4.17 as builder + +# Add kubernetes repository +ADD openshift/ci-operator/build-image/kubernetes.repo /etc/yum.repos.d/ + +RUN yum install -y kubectl httpd-tools + +# Allow runtime users to add entries to /etc/passwd +RUN chmod g+rw /etc/passwd diff --git a/openshift/ci-operator/build-image/kubernetes.repo b/openshift/ci-operator/build-image/kubernetes.repo new file mode 100644 index 0000000000..fb52c559ab --- /dev/null +++ b/openshift/ci-operator/build-image/kubernetes.repo @@ -0,0 +1,6 @@ +[kubernetes] +name=Kubernetes +baseurl=https://pkgs.k8s.io/core:/stable:/v1.29/rpm/ +enabled=1 +gpgcheck=1 +gpgkey=https://pkgs.k8s.io/core:/stable:/v1.29/rpm/repodata/repomd.xml.key diff --git a/openshift/ci-operator/generate-ci-config.sh b/openshift/ci-operator/generate-ci-config.sh new file mode 100755 index 0000000000..b4201955aa --- /dev/null +++ b/openshift/ci-operator/generate-ci-config.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +# Copyright 2019 The OpenShift Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -n "$1" ]; then + # Use provided branch value + branch=$1 +else + # Use current branch otherwise + branch=$(git rev-parse --abbrev-ref HEAD) +fi +version=$(echo ${branch} | cut -d '-' -f 2) +tag=${version:-'main'} +promotion=${branch/release/knative} + +cat </dev/null; then + echo "Release branch doesn't exist yet, using main" + branch="main" + fi + + local operator_dir=/tmp/serverless-operator + local failed=0 + header "Installing serverless operator from openshift-knative/serverless-operator branch $branch" + rm -rf $operator_dir + git clone --branch $branch $repository $operator_dir || failed=1 + pushd $operator_dir + # unset OPENSHIFT_BUILD_NAMESPACE (old CI) and OPENSHIFT_CI (new CI) as its used in serverless-operator's CI + # environment as a switch to use CI built images, we want pre-built images of k-s-o and k-o-i + unset OPENSHIFT_BUILD_NAMESPACE + unset OPENSHIFT_CI + + # Install all components Serving,Eventing,Strimzi and Kafka + make install-all || failed=1 + subheader "Successfully installed serverless operator." + + # Workaround default 'https' scheme + oc patch knativeserving knative-serving \ + --namespace knative-serving --type merge \ + --patch '{"spec":{"config":{"network":{"default-external-scheme":"http"}}}}' || return 1 + + header "Applying Strimzi Topic CR" + cat <<-EOF | oc apply -n kafka -f - || failed=1 +apiVersion: kafka.strimzi.io/v1beta1 +kind: KafkaTopic +metadata: + name: test-topic + labels: + strimzi.io/cluster: my-cluster +spec: + partitions: 100 + replicas: 1 +EOF + + popd + return $failed +} + +# Add to exec script if needed +resources_debug() { + echo ">> Check resources" + echo ">> - meminfo:" + cat /proc/meminfo + echo ">> - memory.limit_in_bytes" + cat /sys/fs/cgroup/memory/memory.limit_in_bytes + echo ">> - cpu.cfs_period_us" + cat /sys/fs/cgroup/cpu/cpu.cfs_period_us + echo ">> - cpu.cfs_quota_us" + cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us +} diff --git a/openshift/e2e-tests-local.sh b/openshift/e2e-tests-local.sh new file mode 100755 index 0000000000..8bd076fea3 --- /dev/null +++ b/openshift/e2e-tests-local.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# The script executes E2E tests + +source "$(dirname "$0")/e2e-common.sh" + +set +x + +failed=0 + +(( !failed )) && run_client_e2e_tests "" "${TEST}" || failed=1 +(( failed )) && exit 1 + +success diff --git a/openshift/e2e-tests-openshift.sh b/openshift/e2e-tests-openshift.sh new file mode 100755 index 0000000000..9fae5e0eca --- /dev/null +++ b/openshift/e2e-tests-openshift.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# The script prepares Serving/Eventing instances on OpenShift and executes E2E tests + +source "$(dirname "$0")/e2e-common.sh" + +set -Eeuox pipefail + +failed=0 + +# Build binary & unit tests +(( !failed )) && build_knative_client || failed=1 +(( !failed )) && run_unit_tests || failed=1 + +if [[ "${PULL_BASE_REF:-}" == "release-next" ]]; then + # Midstream based setup to run on nightly versions of Serving & Eventing + # Serving setup & tests + (( !failed )) && install_serverless_operator_release_next || failed=1 + (( !failed )) && run_client_e2e_tests serving || failed=1 + # Eventing setup & tests + (( !failed )) && install_knative_eventing_branch "${EVENTING_BRANCH}" || failed=1 + (( !failed )) && run_client_e2e_tests eventing || failed=1 +else + # Serverless operator based setup for release branches + (( !failed )) && install_serverless_operator_branch "${SERVERLESS_BRANCH}" || failed=1 + (( !failed )) && run_client_e2e_tests serving || failed=1 + (( !failed )) && run_client_e2e_tests eventing || failed=1 +fi + +(( failed )) && exit 1 + +success diff --git a/openshift/patches/001-test-images.patch b/openshift/patches/001-test-images.patch new file mode 100644 index 0000000000..c2a96f9640 --- /dev/null +++ b/openshift/patches/001-test-images.patch @@ -0,0 +1,22 @@ +diff --git a/test/test_images/helloworld/Dockerfile b/test/test_images/helloworld/Dockerfile +index a973e4a9..87cd0c79 100644 +--- a/test/test_images/helloworld/Dockerfile ++++ b/test/test_images/helloworld/Dockerfile +@@ -1,7 +1,7 @@ + # Use the official Golang image to create a build artifact. + # This is based on Debian and sets the GOPATH to /go. + # https://hub.docker.com/_/golang +-FROM docker.io/library/golang:1.13 as builder ++FROM quay.io/openshift-knative/golang:1.13 as builder + + # Create and change to the app directory. + WORKDIR /app +@@ -15,7 +15,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -v -o server + # Use the official Alpine image for a lean production container. + # https://hub.docker.com/_/alpine + # https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds +-FROM docker.io/library/alpine:3 ++FROM quay.io/openshift-knative/alpine:3 + RUN apk add --no-cache ca-certificates + + # Copy the binary to the production image from the builder stage. diff --git a/openshift/patches/100-ko-baseimage.patch b/openshift/patches/100-ko-baseimage.patch new file mode 100644 index 0000000000..2362bd8e93 --- /dev/null +++ b/openshift/patches/100-ko-baseimage.patch @@ -0,0 +1,11 @@ +diff --git a/.ko.yaml b/.ko.yaml +index ddbf8102f..52293b3da 100644 +--- a/.ko.yaml ++++ b/.ko.yaml +@@ -1,4 +1,4 @@ +-defaultBaseImage: gcr.io/distroless/static:nonroot ++defaultBaseImage: registry.access.redhat.com/ubi8/ubi-minimal:latest + baseImageOverrides: + knative.dev/client/cmd/kn: docker.io/library/alpine:latest + builds: + diff --git a/openshift/release/README.md b/openshift/release/README.md new file mode 100644 index 0000000000..39d086f1a5 --- /dev/null +++ b/openshift/release/README.md @@ -0,0 +1,35 @@ +# Release creation + +## Branching + +As far as branching goes, we have two use-cases: + +1. Creating a branch based off an upstream release tag. +2. Having a branch that follow upstream's HEAD and serves as a vehicle for continuous integration. + +A prerequisite for both scripts is that your local clone of the repository has a remote "upstream" +that points to the upstream repository and a remote "openshift" that points to the openshift fork. + +Run the scripts from the root of the repository. + +### Creating a branch based off an upstream release tag + +To create a clean branch from an upstream release tag, use the `create-release-branch.sh` script: + +```bash +$ ./openshift/release/create-release-branch.sh v0.4.1 release-0.4 +``` + +This will create a new branch "release-0.4" based off the tag "v0.4.1" and add all OpenShift specific +files that we need to run CI on top of it. + +### Updating the release-next branch that follow upstream's HEAD + +To update a branch to the latest HEAD of upstream use the `update-to-head.sh` script: + +```bash +$ ./openshift/release/update-to-head.sh +``` + +That will pull the latest main from upstream, rebase the current fixes on the release-next branch +on top of it, update the Openshift specific files if necessary, and then trigger CI. \ No newline at end of file diff --git a/openshift/release/create-release-branch.sh b/openshift/release/create-release-branch.sh new file mode 100755 index 0000000000..4a14980e0f --- /dev/null +++ b/openshift/release/create-release-branch.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Copyright 2019 The OpenShift Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Usage: create-release-branch.sh v0.4.1 release-0.4 + +release=$1 +target=$2 + +ROOT_DIR=$(dirname "$0")/../.. +source "$ROOT_DIR/openshift/release/common.sh" + +# Custom files +custom_files=$(cat <> "$TMPDIR"/midstream_branches < "$TMPDIR"/upstream_branches +git branch --list -a "openshift/release-v1.*" | cut -f3 -d'/' | cut -f2 -d'v' | cut -f1,2 -d'.' >> "$TMPDIR"/midstream_branches + +sort -o "$TMPDIR"/midstream_branches "$TMPDIR"/midstream_branches +sort -o "$TMPDIR"/upstream_branches "$TMPDIR"/upstream_branches +comm -32 "$TMPDIR"/upstream_branches "$TMPDIR"/midstream_branches > "$TMPDIR"/new_branches + +UPSTREAM_BRANCHES=$(cat "$TMPDIR"/new_branches | tr '\n' ' ') + +if [ -z "$UPSTREAM_BRANCHES" ]; then + echo "no new branch, exiting" + exit 0 +fi + +for UPSTREAM_BRANCH in ${UPSTREAM_BRANCHES[@]}; do + echo "found upstream branch: $UPSTREAM_BRANCH" + UPSTREAM_TAG="knative-v$UPSTREAM_BRANCH.0" + MIDSTREAM_BRANCH="release-v$UPSTREAM_BRANCH" + $(dirname "${BASH_SOURCE[0]}")/create-release-branch.sh "$UPSTREAM_TAG" "$MIDSTREAM_BRANCH" + # we would check the error code, but we 'set -e', so assume we're fine + git push openshift "$MIDSTREAM_BRANCH" +done diff --git a/openshift/release/plugin_register.go b/openshift/release/plugin_register.go new file mode 100644 index 0000000000..5e35f4c7e2 --- /dev/null +++ b/openshift/release/plugin_register.go @@ -0,0 +1,23 @@ +// Copyright © 2020 The OpenShift Knative Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package root + +import ( + // Add #plugins# import here. Don't remove this line, it triggers an automatic replacement. +) + +// RegisterInlinePlugins is an empty function which however forces the +// compiler to run all init() methods of the registered imports +func RegisterInlinePlugins() {} diff --git a/openshift/release/update-to-head.sh b/openshift/release/update-to-head.sh new file mode 100755 index 0000000000..733f1973ba --- /dev/null +++ b/openshift/release/update-to-head.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# Copyright 2019 The OpenShift Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Synchs the ${REPO_BRANCH} branch to main and then triggers CI +# Usage: update-to-head.sh + +set -e +REPO_NAME=$(basename $(git rev-parse --show-toplevel)) +REPO_OWNER_NAME="openshift-knative" +REPO_BRANCH=release-next +REPO_BRANCH_CI="${REPO_BRANCH}-ci" + +# Check if there's an upstream release we need to mirror downstream +openshift/release/mirror-upstream-branches.sh + +# Custom files +custom_files=$(cat < ci +git add ci +git commit -m "${message}" +git push -f openshift ${REPO_BRANCH_CI} + +if hash hub 2>/dev/null; then + # Test if there is already a sync PR in + COUNT=$(hub api -H "Accept: application/vnd.github.v3+json" repos/${REPO_OWNER_NAME}/${REPO_NAME}/pulls --flat \ + | grep -c "${message}") || true + if [ "$COUNT" = "0" ]; then + hub pull-request -m "${message}" -l "kind/sync-fork-to-upstream,approved,lgtm" -b ${REPO_OWNER_NAME}/${REPO_NAME}:${REPO_BRANCH} -h ${REPO_OWNER_NAME}/${REPO_NAME}:${REPO_BRANCH_CI} + fi +else + echo "hub (https://github.com/github/hub) is not installed, so you'll need to create a PR manually." +fi diff --git a/openshift/serverless/operator-install.yaml b/openshift/serverless/operator-install.yaml new file mode 100644 index 0000000000..c582a7d03b --- /dev/null +++ b/openshift/serverless/operator-install.yaml @@ -0,0 +1,34 @@ +# Copyright 2019 The OpenShift Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: operators.coreos.com/v1 +kind: CatalogSourceConfig +metadata: + name: ci-serverless-operator + namespace: openshift-marketplace +spec: + targetNamespace: openshift-operators + packages: serverless-operator + source: redhat-operators +--- +apiVersion: operators.coreos.com/v1alpha1 +kind: Subscription +metadata: + name: serverless-operator + namespace: openshift-operators +spec: + channel: techpreview + name: serverless-operator + source: ci-serverless-operator + sourceNamespace: openshift-operators diff --git a/package_cliartifacts.sh b/package_cliartifacts.sh new file mode 100755 index 0000000000..2bea1662a8 --- /dev/null +++ b/package_cliartifacts.sh @@ -0,0 +1,59 @@ +# This script is used to package kn cross platform cli artifacts +# for kn-cli-artifacts image +# Copyright 2020 The OpenShift Knative Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +pkg_tar() { + local dir + case "$1" in + amd64|arm64|ppc64le|s390x) + dir=linux-$1 + mkdir "${OUTDIR}/${dir}" + mv kn-linux-$1 ${OUTDIR}/${dir}/kn + chmod +x ${OUTDIR}/${dir}/kn + ;; + macos) + dir=macos-amd64 + mkdir "${OUTDIR}/${dir}" + mv kn-darwin-amd64 ${OUTDIR}/${dir}/kn + chmod +x ${OUTDIR}/${dir}/kn + ;; + macos-arm64) + dir=macos-arm64 + mkdir "${OUTDIR}/${dir}" + mv kn-darwin-arm64 ${OUTDIR}/${dir}/kn + chmod +x ${OUTDIR}/${dir}/kn + ;; + esac + cp LICENSE ${OUTDIR}/${dir} + tar -zcf kn-${dir}.tar.gz -C ${OUTDIR}/${dir} . +} + +pkg_zip_for_windows() { + mkdir "${OUTDIR}/windows" + mv kn-windows-amd64.exe ${OUTDIR}/windows/kn.exe + cp LICENSE ${OUTDIR}/windows/ + zip --quiet --junk-path - ${OUTDIR}/windows/* > kn-windows-amd64.zip +} + +OUTDIR=$(mktemp -dt knbinary.XXXXXXXXXX) +trap "rm -rf '${OUTDIR}'" EXIT INT TERM + +pkg_tar amd64 +pkg_tar arm64 +pkg_tar ppc64le +pkg_tar s390x +pkg_tar macos +pkg_tar macos-arm64 +pkg_zip_for_windows