Skip to content

Commit

Permalink
Merge pull request #575 from tchughesiv/build7.9.1
Browse files Browse the repository at this point in the history
[KIECLOUD-482] switch to build version for csv release
  • Loading branch information
openshift-merge-robot authored Jan 5, 2021
2 parents 96edfc2 + b3fd8b5 commit f01e4e6
Show file tree
Hide file tree
Showing 14 changed files with 257 additions and 217 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,21 @@ To install this operator on OpenShift 4 for end-to-end testing, make sure you ha
If pushing to another quay repository, replace _kiegroup_ with your username or other namespace. Also note that the push command does not overwrite an existing repository, and it needs to be deleted before a new version can be built and uploaded. Once the bundle has been uploaded, create an [Operator Source](https://github.com/operator-framework/community-operators/blob/master/docs/testing-operators.md#linking-the-quay-application-repository-to-your-openshift-40-cluster) to load your operator bundle in OpenShift.

**Create your own index image**

Requires [opm](https://github.com/operator-framework/operator-registry/releases) v1.15.3+ -

```bash
$ make bundle-dev
USERNAME=tchughesiv
VERSION=$(go run getversion.go)
VERSION=$(go run getversion.go -csv)
IMAGE=quay.io/${USERNAME}/rhpam-operator-bundle
BUNDLE=${IMAGE}:${VERSION}

$ docker push ${BUNDLE}
BUNDLE_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${BUNDLE})
INDEX_VERSION=v4.6
INDEX_IMAGE=quay.io/${USERNAME}/ba-operator-index:${INDEX_VERSION}
INDEX_FROM=${INDEX_IMAGE}_$(go run getversion.go --prior)
INDEX_FROM=${INDEX_IMAGE}_$(go run getversion.go -csvPrior)
INDEX_TO=${INDEX_IMAGE}_${VERSION}

$ opm index add -c docker --bundles ${BUNDLE_DIGEST} --from-index ${INDEX_FROM} --tag ${INDEX_TO}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion getversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ import (
)

var (
prior = flag.Bool("prior", false, "get prior product version")
prior = flag.Bool("prior", false, "get prior product version")
csv = flag.Bool("csv", false, "get csv version")
csvPrior = flag.Bool("csvPrior", false, "get prior csv version")
)

func main() {
flag.Parse()
if *prior {
fmt.Println(version.PriorVersion)
} else if *csv {
fmt.Println(version.CsvVersion)
} else if *csvPrior {
fmt.Println(version.CsvPriorVersion)
} else {
fmt.Println(version.Version)
}
Expand Down
28 changes: 28 additions & 0 deletions go.sum

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions hack/go-build-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ fi

echo ${CFLAGS}

VERSION=$(go run getversion.go)
CSVVERSION=$(go run getversion.go -csv)

OLMDIR=deploy/olm-catalog/prod
BUNDLE_NAME=rhpam-7/${BUNDLE}
CSV=businessautomation-operator.${VERSION}.clusterserviceversion.yaml
CSV=businessautomation-operator.${CSVVERSION}.clusterserviceversion.yaml
if [[ ${DEV} == true ]]; then
OLMDIR=deploy/olm-catalog/dev
BUNDLE_NAME=quay.io/tchughesiv/${BUNDLE}
fi
VERDIR=${OLMDIR}/${VERSION}
VERDIR=${OLMDIR}/${CSVVERSION}
CRD=kieapp.crd.yaml
if (( $(echo "${VERSION} 7.9.0" | awk '{print ($1 < $2)}') )); then
if (( $(echo "${CSVVERSION} 7.9.0" | awk '{print ($1 < $2)}') )); then
CRD=kieapp.crd.v1beta1.yaml
fi
ANNO=annotations.yaml
Expand All @@ -51,7 +51,7 @@ cekit-cache add --md5 ${MD5_ANNO} ${ANNO_PATH}

cekit -v --descriptor image-bundle.yaml --redhat build \
--overrides '{name: '${BUNDLE_NAME}'}' \
--overrides '{version: '${VERSION}'}' \
--overrides '{version: '${CSVVERSION}'}' \
--overrides '{
artifacts: [
{name: '${CSV}', path: '${CSV_PATH}', md5: '${MD5_CSV}', dest: '/manifests'},
Expand All @@ -65,7 +65,7 @@ artifacts: [
{"container":
{
"operator_manifests":
{"enable_digest_pinning": false, "enable_repo_replacements": false, "enable_registry_replacements": false, "manifests_dir": 'modules/olm-catalog/${VERSION}/manifests'},
{"enable_digest_pinning": false, "enable_repo_replacements": false, "enable_registry_replacements": false, "manifests_dir": 'modules/olm-catalog/${CSVVERSION}/manifests'},
"platforms":
{"only": ["x86_64"]}
}
Expand Down
5 changes: 2 additions & 3 deletions hack/go-csv.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/sh

source ./hack/go-mod-env.sh
VERSION=$(go run getversion.go)
VERSION=$(go run getversion.go -csv)

#go run ./tools/csv-gen/csv-gen.go
go run ./tools/csv-gen/csv-gen.go -replaces 7.9.0-2
go run ./tools/csv-gen/csv-gen.go

operator-sdk bundle validate deploy/olm-catalog/dev/${VERSION}
operator-sdk bundle validate deploy/olm-catalog/prod/${VERSION}
8 changes: 4 additions & 4 deletions pkg/controller/kieapp/deploy_ui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
)

func TestUpdateLink(t *testing.T) {
box := packr.New("CSV", "../../../deploy/olm-catalog/prod/"+version.Version+"/manifests")
bytes, err := box.Find("businessautomation-operator." + version.Version + ".clusterserviceversion.yaml")
box := packr.New("CSV", "../../../deploy/olm-catalog/prod/"+version.CsvVersion+"/manifests")
bytes, err := box.Find("businessautomation-operator." + version.CsvVersion + ".clusterserviceversion.yaml")
assert.Nil(t, err, "Error reading CSV file")
csv := &operators.ClusterServiceVersion{}
err = yaml.Unmarshal(bytes, csv)
Expand All @@ -37,8 +37,8 @@ func TestUpdateLink(t *testing.T) {
}

func TestUpdateExistingLink(t *testing.T) {
box := packr.New("CSV", "../../../deploy/olm-catalog/prod/"+version.Version+"/manifests")
bytes, err := box.Find("businessautomation-operator." + version.Version + ".clusterserviceversion.yaml")
box := packr.New("CSV", "../../../deploy/olm-catalog/prod/"+version.CsvVersion+"/manifests")
bytes, err := box.Find("businessautomation-operator." + version.CsvVersion + ".clusterserviceversion.yaml")
assert.Nil(t, err, "Error reading CSV file")
csv := &operators.ClusterServiceVersion{}
err = yaml.Unmarshal(bytes, csv)
Expand Down
4 changes: 2 additions & 2 deletions tools/csv-gen/csv-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ var (
)

var (
ver = flag.String("version", version.Version, "set CSV version")
replaces = flag.String("replaces", version.PriorVersion, "set CSV version to replace")
ver = flag.String("version", version.CsvVersion, "set CSV version")
replaces = flag.String("replaces", version.CsvPriorVersion, "set CSV version to replace")
)

type csvSetting struct {
Expand Down
4 changes: 4 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import (
var (
// Version - current version
Version = constants.CurrentVersion
// CsvVersion - csv release
CsvVersion = Version + "-1"
// PriorVersion - prior version
PriorVersion = constants.PriorVersion1
// CsvPriorVersion - prior csv release
CsvPriorVersion = PriorVersion + "-2"
)

0 comments on commit f01e4e6

Please sign in to comment.