Skip to content

Commit

Permalink
Added missing fields in CSV, improved verification
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Sluiter <[email protected]>
  • Loading branch information
slintes committed Apr 17, 2019
1 parent e9aad6f commit e5983f7
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ script:
- if [[ $TRAVIS_REPO_SLUG == "kubevirt/kubevirt" ]]; then make goveralls; else make bazel-tests; fi
- make apidocs
- make client-python
- make manifests QUAY_REPOSITORY="kubevirt" DOCKER_PREFIX="docker.io/kubevirt" DOCKER_TAG=$TRAVIS_TAG # falls back to latest if not on a tag
- make manifests DOCKER_PREFIX="docker.io/kubevirt" DOCKER_TAG=$TRAVIS_TAG # skip getting old CSVs here (no QUAY_REPOSITORY), verification might fail because of stricter rules over time; falls back to latest if not on a tag
- make olm-verify

deploy:
Expand Down
1 change: 1 addition & 0 deletions docs/devel/olm-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ Travis cares for this on every release.
## Sources

[CSV description](https://github.com/operator-framework/operator-lifecycle-manager/blob/master/Documentation/design/building-your-csv.md)
[CSV required fields](https://github.com/operator-framework/community-operators/blob/master/docs/required-fields.md)
[Publish bundles](https://github.com/operator-framework/community-operators/blob/master/docs/testing-operators.md)
[Install OLM](https://github.com/operator-framework/operator-lifecycle-manager/blob/master/Documentation/install/install.md)
[Install and use Marketplace](https://github.com/operator-framework/operator-marketplace)
Expand Down
12 changes: 6 additions & 6 deletions hack/build-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ source hack/config.sh

skipj2=false
if [ "$1" == "--skipj2" ]; then
skipj2=true
skipj2=true
fi

manifest_docker_prefix=${manifest_docker_prefix-${docker_prefix}}
Expand Down Expand Up @@ -82,9 +82,9 @@ for arg in $args; do
--bundle-out-dir=${bundle_out_dir} \
--quay-repository=${QUAY_REPOSITORY} >${outfile}

if [ "$skipj2" = true ] ; then
echo "skipping j2 template for $infile"
continue
if [ "$skipj2" = true ]; then
echo "skipping j2 template for $infile"
continue
fi

${KUBEVIRT_DIR}/tools/manifest-templator/manifest-templator \
Expand All @@ -109,8 +109,8 @@ done
find ${MANIFESTS_OUT_DIR}/ -type f -exec sed -i {} -e '${/^$/d;}' \;
find ${MANIFEST_TEMPLATES_OUT_DIR}/ -type f -exec sed -i {} -e '${/^$/d;}' \;

if [ "$skipj2" = true ] ; then
exit 0
if [ "$skipj2" = true ]; then
exit 0
fi

# make sure that template manifests align with release manifests
Expand Down
2 changes: 1 addition & 1 deletion hack/kubevirt-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN \
go get -u github.com/rmohr/go-swagger-utils/swagger-doc && \
go get -u github.com/onsi/ginkgo/ginkgo

RUN pip install j2cli && pip3 install operator-courier
RUN pip install j2cli && pip3 install operator-courier==1.3.0

COPY rsyncd.conf /etc/rsyncd.conf

Expand Down
13 changes: 5 additions & 8 deletions hack/olm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,18 @@ if [ $# -ne 1 ]; then
fi

BUNDLE_DIR=${OUT_DIR}/manifests/release/olm/bundle

echo "operator-courier version:"
operator-courier --version

echo "using these manifests:"
ls ${BUNDLE_DIR}

case ${1} in

verify)

IFS=
result=$(operator-courier verify ${BUNDLE_DIR} 2>&1)
echo $result

if [[ $result =~ "ERROR" ]]; then
echo "olm verify failed!"
exit 1
fi
operator-courier verify --ui_validate_io ${BUNDLE_DIR}

echo "olm verify success!"
exit 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ metadata:
name: kubevirtoperator.{{.CsvVersion}}
namespace: placeholder
annotations:
capabilities: "Full Lifecycle"
categories: "Virtualization"
capabilities: Seamless Upgrades
categories: "OpenShift Optional"
containerImage: {{.DockerPrefix}}/virt-operator:{{.DockerTag}}
createdAt: {{.CreatedAt}}
repository: https://github.com/kubevirt/kubevirt
alm-examples: |
[
{
Expand All @@ -25,8 +28,7 @@ spec:
displayName: KubeVirt
description: |
KubeVirt is a cluster add-on that provides a way to run virtualized workloads alongside containerized workload in a Kubernetes / OpenShift native way.

_The KubeVirt Operator does not support updates yet._
Minor and patch level updates are supported.
keywords:
- KubeVirt
- Virtualization
Expand Down
8 changes: 8 additions & 0 deletions tools/manifest-templator/manifest-templator.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"path/filepath"
"strings"
"text/template"
"time"

v1 "k8s.io/api/core/v1"

Expand All @@ -54,6 +55,7 @@ type templateData struct {
OperatorRules string
KubeVirtLogo string
PackageName string
CreatedAt string
GeneratedManifests map[string]string
}

Expand Down Expand Up @@ -99,6 +101,7 @@ func main() {
data.OperatorRules = getOperatorRules()
data.KubeVirtLogo = getKubeVirtLogo(*kubeVirtLogoPath)
data.PackageName = *packageName
data.CreatedAt = getTimestamp()
// prevent loading latest bundle from Quay for every file, only do it for the CSV manifest
data.ReplacesCsvVersion = ""
if strings.Contains(*inputFile, ".csv.yaml") && *bundleOutDir != "" && data.QuayRepository != "" {
Expand Down Expand Up @@ -135,6 +138,7 @@ func main() {
data.OperatorRules = "{{.OperatorRules}}"
data.KubeVirtLogo = "{{.KubeVirtLogo}}"
data.PackageName = "{{.PackageName}}"
data.CreatedAt = "{{.CreatedAt}}"
}

if *processFiles {
Expand Down Expand Up @@ -226,3 +230,7 @@ func getKubeVirtLogo(path string) string {
encoded := base64.StdEncoding.EncodeToString(content)
return encoded
}

func getTimestamp() string {
return time.Now().UTC().Format("2006-01-02T15:04:05Z")
}

0 comments on commit e5983f7

Please sign in to comment.