argo-cd/hack/update-openapi.sh
github-actions[bot] 4d9835927d
Bump major version to 3 (#21410)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
2025-01-10 16:14:00 -05:00

33 lines
894 B
Bash
Executable file

#!/bin/bash
set -x
set -o errexit
set -o nounset
set -o pipefail
PROJECT_ROOT=$(
cd $(dirname "$0")/..
pwd
)
PATH="${PROJECT_ROOT}/dist:${PATH}"
GOPATH=$(go env GOPATH)
GOPATH_PROJECT_ROOT="${GOPATH}/src/github.com/argoproj/argo-cd"
VERSION="v1alpha1"
[ -e ./v3 ] || ln -s . v3
[ -e "${GOPATH_PROJECT_ROOT}" ] || (mkdir -p "$(dirname "${GOPATH_PROJECT_ROOT}")" && ln -s "${PROJECT_ROOT}" "${GOPATH_PROJECT_ROOT}")
openapi-gen \
--go-header-file ${PROJECT_ROOT}/hack/custom-boilerplate.go.txt \
--output-pkg github.com/argoproj/argo-cd/v3/pkg/apis/application/${VERSION} \
--report-filename pkg/apis/api-rules/violation_exceptions.list \
--output-dir "${GOPATH}/src" \
$@
[ -L "${GOPATH_PROJECT_ROOT}" ] && rm -rf "${GOPATH_PROJECT_ROOT}"
[ -L ./v3 ] && rm -rf v3
export GO111MODULE=on
go build -o ./dist/gen-crd-spec "${PROJECT_ROOT}/hack/gen-crd-spec"
./dist/gen-crd-spec