...
1#!/bin/bash
2
3# This script is meant to be the entrypoint for OpenShift Bash scripts to import all of the support
4# libraries at once in order to make Bash script preambles as minimal as possible. This script recur-
5# sively `source`s *.sh files in this directory tree. As such, no files should be `source`ed outside
6# of this script to ensure that we do not attempt to overwrite read-only variables.
7
8set -o errexit
9set -o nounset
10set -o pipefail
11
12SCRIPT_ROOT=$(cd $(dirname "${BASH_SOURCE[0]}")/../.. && pwd)
13PACKAGE_NAME="github.com/openshift/api"
14
15TOOLS_MAKE="make -C ${SCRIPT_ROOT}/tools"
16TOOLS_OUTPUT="${SCRIPT_ROOT}/tools/_output/bin/$(go env GOOS)/$(go env GOARCH)"
17
18# find_api_group_versions uses regex to look for any folder that looks like it would be an API group version.
19# eg. foo/v1, bar/v1beta1 or baz/v1alpha1. It then outputs a list of <api>/<version> for those API group versions.
20# API group versions are required for the following generators:
21# - compatibility
22# - deepcopy
23# - openapi
24# - swagger
25find_api_group_versions() {
26 # Use separate regexes because the `|` operator doesn't work consistently on different versions of find.
27 # Use sed to trim the SCRIPT_ROOT from the output to create the <api>/<version> strings.
28 find "${SCRIPT_ROOT}" -type d \( -regex "${SCRIPT_ROOT}/[a-z]*/v[0-9]" -o -regex "${SCRIPT_ROOT}/[a-z]*/v[0-9]alpha[0-9]" -o -regex "${SCRIPT_ROOT}/[a-z]*/v[0-9]beta[0-9]" \) | sed "s|^${SCRIPT_ROOT}/||" | sort
29}
30
31# Find the API group versions when not already set.
32# Include non-standard groupversions from the image API as well.
33API_GROUP_VERSIONS=${API_GROUP_VERSIONS:-"$(find_api_group_versions) image/docker10 image/dockerpre012"}
34
35# API Packages is used by the protobuf generator.
36# Protobuf generation is explicitly opt-in for packages so these must be listed here.
37API_PACKAGES="\
38github.com/openshift/api/apps/v1,\
39github.com/openshift/api/authorization/v1,\
40github.com/openshift/api/build/v1,\
41github.com/openshift/api/image/v1,\
42github.com/openshift/api/cloudnetwork/v1,\
43github.com/openshift/api/network/v1,\
44github.com/openshift/api/networkoperator/v1,\
45github.com/openshift/api/oauth/v1,\
46github.com/openshift/api/project/v1,\
47github.com/openshift/api/quota/v1,\
48github.com/openshift/api/route/v1,\
49github.com/openshift/api/samples/v1,\
50github.com/openshift/api/security/v1,\
51github.com/openshift/api/template/v1,\
52github.com/openshift/api/user/v1\
53"
View as plain text