diff --git a/.github/workflows/image-build.yaml b/.github/workflows/image-build.yaml deleted file mode 100644 index 8003a025..00000000 --- a/.github/workflows/image-build.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Build Operator image - -on: - push: - branches: [main] - -jobs: - image: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Build - run: | - scripts/install-tools.sh - make image - - name: Push - run: | - echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin - make image-push image-push-latest diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..e6df6be0 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,91 @@ +name: Release Operator + +on: + pull_request: + branches: [ release-1.0 ] + push: + tags: [ v1.* ] + +env: + GO_VER: 1.18.4 + GO_TAGS: "" + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + SEMREV_LABEL: ${{ github.ref_name }} + +permissions: + contents: read + +jobs: + build-and-push-image: + runs-on: ubuntu-20.04 + + permissions: + contents: read + packages: write + + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + buildkitd-flags: --debug + config-inline: | + [worker.oci] + max-parallelism = 1 + + - name: Checkout + uses: actions/checkout@v3 + + - name: Login to the GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}}.{{minor}}.{{patch}} + + - name: Build and push + id: push + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + push: ${{ github.event_name != 'pull_request' }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + GO_VER=${{ env.GO_VER }} + GO_TAGS=${{ env.GO_TAGS }} + BUILD_ID=${{ env.SEMREV_LABEL }} + BUILD_DATE=${{ env.BUILD_DATE }} + + + create-release: + name: Create GitHub Release + needs: [ build-and-push-image ] + runs-on: ubuntu-20.04 + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Release Operator Version + uses: ncipollo/release-action@v1 + with: + allowUpdates: "true" + bodyFile: release_notes/${{ env.SEMREV_LABEL }}.md + tag: ${{ env.SEMREV_LABEL }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index 4af4582e..9e0fc266 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,17 @@ -ARG ARCH -ARG REGISTRY ARG GO_VER ########## Build operator binary ########## FROM registry.access.redhat.com/ubi8/go-toolset:$GO_VER as builder -COPY . /go/src/github.com/IBM-Blockchain/fabric-operator -WORKDIR /go/src/github.com/IBM-Blockchain/fabric-operator -RUN GOOS=linux GOARCH=$(go env GOARCH) CGO_ENABLED=1 go build -mod=vendor -tags "pkcs11" -gcflags all=-trimpath=${GOPATH} -asmflags all=-trimpath=${GOPATH} -o /tmp/build/_output/bin/ibp-operator + +COPY . /go/src/github.com/hyperledger-labs/fabric-operator +WORKDIR /go/src/github.com/hyperledger-labs/fabric-operator + +# RUN GOOS=linux GOARCH=$(go env GOARCH) CGO_ENABLED=1 go build +RUN go build \ + -tags "pkcs11" \ + -gcflags all=-trimpath=${GOPATH} \ + -asmflags all=-trimpath=${GOPATH} \ + -o /tmp/build/_output/bin/ibp-operator ########## Final Image ########## FROM registry.access.redhat.com/ubi8/ubi-minimal @@ -19,6 +24,7 @@ COPY definitions /definitions COPY config/crd/bases /deploy/crds COPY defaultconfig /defaultconfig COPY docker-entrypoint.sh . + RUN microdnf update \ && microdnf install -y \ shadow-utils \ diff --git a/Makefile b/Makefile index b3f8e106..26df3734 100644 --- a/Makefile +++ b/Makefile @@ -16,50 +16,37 @@ # limitations under the License. # -IMAGE ?= ghcr.io/hyperledger-labs/fabric-operator -TAG ?= $(shell git rev-parse --short HEAD) +IMAGE ?= hyperledger-labs/fabric-operator ARCH ?= $(shell go env GOARCH) -OSS_GO_VER ?= 1.17.7 -BUILD_DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ") OS = $(shell go env GOOS) +SEMREV_LABEL ?= v1.0.0-$(shell git rev-parse --short HEAD) +BUILD_DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ") +GO_VER ?= 1.18.4 -DOCKER_IMAGE_REPO ?= ghcr.io +# For compatibility with legacy install-fabric.sh conventions, strip the +# leading semrev 'v' character when preparing dist and release artifacts. +VERSION=$(shell echo $(SEMREV_LABEL) | sed -e 's/^v\(.*\)/\1/') -BUILD_ARGS=--build-arg ARCH=$(ARCH) -BUILD_ARGS+=--build-arg BUILD_ID=$(TAG) -BUILD_ARGS+=--build-arg BUILD_DATE=$(BUILD_DATE) -BUILD_ARGS+=--build-arg GO_VER=$(OSS_GO_VER) -ifneq ($(origin TRAVIS_PULL_REQUEST),undefined) - ifneq ($(TRAVIS_PULL_REQUEST), false) - TAG=pr-$(TRAVIS_PULL_REQUEST) - endif -endif +DOCKER_BUILD ?= docker build -NAMESPACE ?= n$(shell echo $(TAG) | tr -d "-") +BUILD_ARGS+=--build-arg BUILD_ID=$(VERSION) +BUILD_ARGS+=--build-arg BUILD_DATE=$(BUILD_DATE) +BUILD_ARGS+=--build-arg GO_VER=$(GO_VER) .PHONY: build -build: ## Builds the starter pack +build: mkdir -p bin && go build -o bin/operator image: setup - docker build --rm . -f Dockerfile $(BUILD_ARGS) -t $(IMAGE):$(TAG)-$(ARCH) - docker tag $(IMAGE):$(TAG)-$(ARCH) $(IMAGE):latest-$(ARCH) + $(DOCKER_BUILD) -f Dockerfile $(BUILD_ARGS) -t $(IMAGE) . govendor: @go mod vendor setup: govendor manifests bundle generate -image-push: - docker push $(IMAGE):$(TAG)-$(ARCH) - -image-push-latest: - docker push $(IMAGE):latest-$(ARCH) - -login: - docker login --username $(DOCKER_USERNAME) --password $(DOCKER_PASSWORD) $(DOCKER_IMAGE_REPO) ####################################### #### part of autogenerate makefile #### @@ -156,14 +143,6 @@ vet: generate: controller-gen $(CONTROLLER_GEN) object:headerFile="boilerplate/boilerplate.go.txt" paths="./..." -# Build the docker image -docker-build: test - docker build . -t ${IMG} - -# Push the docker image -docker-push: - docker push ${IMG} - # find or download controller-gen # download controller-gen if necessary controller-gen: @@ -188,7 +167,7 @@ ifeq (, $(shell which kustomize)) KUSTOMIZE_GEN_TMP_DIR=$$(mktemp -d) ;\ cd $$KUSTOMIZE_GEN_TMP_DIR ;\ go mod init tmp ;\ - go install sigs.k8s.io/kustomize/kustomize/v3@v3.5.4 ;\ + go install sigs.k8s.io/kustomize/kustomize/v4@v4.5.7 ;\ rm -rf $$KUSTOMIZE_GEN_TMP_DIR ;\ } KUSTOMIZE=$(GOBIN)/kustomize diff --git a/bundle.Dockerfile b/bundle.Dockerfile index ebbe8fa3..34e109dd 100644 --- a/bundle.Dockerfile +++ b/bundle.Dockerfile @@ -6,15 +6,10 @@ LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ LABEL operators.operatorframework.io.bundle.package.v1=fabric-opensource-operator LABEL operators.operatorframework.io.bundle.channels.v1=alpha -LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.19.0+git +LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.24.1 LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3 -# Labels for testing. -LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 -LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ - # Copy files to locations specified by labels. COPY bundle/manifests /manifests/ COPY bundle/metadata /metadata/ -COPY bundle/tests/scorecard /tests/scorecard/ diff --git a/bundle/manifests/fabric-opensource-operator.clusterserviceversion.yaml b/bundle/manifests/fabric-opensource-operator.clusterserviceversion.yaml index cb2bdd3a..f74d47d0 100644 --- a/bundle/manifests/fabric-opensource-operator.clusterserviceversion.yaml +++ b/bundle/manifests/fabric-opensource-operator.clusterserviceversion.yaml @@ -9,11 +9,11 @@ metadata: containerImage: todo:update createdAt: "2020-07-14T00:00:00Z" description: TODO - operators.operatorframework.io/builder: operator-sdk-v1.19.0+git + operators.operatorframework.io/builder: operator-sdk-v1.24.1 operators.operatorframework.io/internal-objects: '["ibpcas.ibp.com","ibppeers.ibp.com","ibporderers.ibp.com"]' operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: "" - name: fabric-opensource-operator.v1.0.0 + name: fabric-opensource-operator.v1.0.0-9726bb6 namespace: placeholder spec: apiservicedefinitions: {} @@ -1886,4 +1886,4 @@ spec: maturity: alpha provider: name: Opensource - version: 1.0.0 + version: 1.0.0-9726bb6 diff --git a/bundle/manifests/ibp.com_ibpcas.yaml b/bundle/manifests/ibp.com_ibpcas.yaml index 0796f93c..491f6f0e 100644 --- a/bundle/manifests/ibp.com_ibpcas.yaml +++ b/bundle/manifests/ibp.com_ibpcas.yaml @@ -1,20 +1,3 @@ -# -# Copyright contributors to the Hyperledger Fabric Operator project -# -# SPDX-License-Identifier: Apache-2.0 -# -# 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: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: diff --git a/bundle/manifests/ibp.com_ibpconsoles.yaml b/bundle/manifests/ibp.com_ibpconsoles.yaml index 5423ea88..76fc9d40 100644 --- a/bundle/manifests/ibp.com_ibpconsoles.yaml +++ b/bundle/manifests/ibp.com_ibpconsoles.yaml @@ -1,20 +1,3 @@ -# -# Copyright contributors to the Hyperledger Fabric Operator project -# -# SPDX-License-Identifier: Apache-2.0 -# -# 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: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: diff --git a/bundle/manifests/ibp.com_ibporderers.yaml b/bundle/manifests/ibp.com_ibporderers.yaml index daa06230..ac2c6df4 100644 --- a/bundle/manifests/ibp.com_ibporderers.yaml +++ b/bundle/manifests/ibp.com_ibporderers.yaml @@ -1,20 +1,3 @@ -# -# Copyright contributors to the Hyperledger Fabric Operator project -# -# SPDX-License-Identifier: Apache-2.0 -# -# 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: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: diff --git a/bundle/manifests/ibp.com_ibppeers.yaml b/bundle/manifests/ibp.com_ibppeers.yaml index 37a8b968..c9be0c2f 100644 --- a/bundle/manifests/ibp.com_ibppeers.yaml +++ b/bundle/manifests/ibp.com_ibppeers.yaml @@ -1,20 +1,3 @@ -# -# Copyright contributors to the Hyperledger Fabric Operator project -# -# SPDX-License-Identifier: Apache-2.0 -# -# 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: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: diff --git a/bundle/metadata/annotations.yaml b/bundle/metadata/annotations.yaml index 5e677aaa..9e837d2b 100644 --- a/bundle/metadata/annotations.yaml +++ b/bundle/metadata/annotations.yaml @@ -5,10 +5,6 @@ annotations: operators.operatorframework.io.bundle.metadata.v1: metadata/ operators.operatorframework.io.bundle.package.v1: fabric-opensource-operator operators.operatorframework.io.bundle.channels.v1: alpha - operators.operatorframework.io.metrics.builder: operator-sdk-v1.19.0+git + operators.operatorframework.io.metrics.builder: operator-sdk-v1.24.1 operators.operatorframework.io.metrics.mediatype.v1: metrics+v1 operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3 - - # Annotations for testing. - operators.operatorframework.io.test.mediatype.v1: scorecard+v1 - operators.operatorframework.io.test.config.v1: tests/scorecard/ diff --git a/config/crd/bases/ibp.com_ibpcas.yaml b/config/crd/bases/ibp.com_ibpcas.yaml index f8850b2f..881c4084 100644 --- a/config/crd/bases/ibp.com_ibpcas.yaml +++ b/config/crd/bases/ibp.com_ibpcas.yaml @@ -1,20 +1,3 @@ -# -# Copyright contributors to the Hyperledger Fabric Operator project -# -# SPDX-License-Identifier: Apache-2.0 -# -# 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: apiextensions.k8s.io/v1 kind: CustomResourceDefinition diff --git a/config/crd/bases/ibp.com_ibpconsoles.yaml b/config/crd/bases/ibp.com_ibpconsoles.yaml index b7d6f927..f8522339 100644 --- a/config/crd/bases/ibp.com_ibpconsoles.yaml +++ b/config/crd/bases/ibp.com_ibpconsoles.yaml @@ -1,20 +1,3 @@ -# -# Copyright contributors to the Hyperledger Fabric Operator project -# -# SPDX-License-Identifier: Apache-2.0 -# -# 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: apiextensions.k8s.io/v1 kind: CustomResourceDefinition diff --git a/config/crd/bases/ibp.com_ibporderers.yaml b/config/crd/bases/ibp.com_ibporderers.yaml index 91adf32c..756d9775 100644 --- a/config/crd/bases/ibp.com_ibporderers.yaml +++ b/config/crd/bases/ibp.com_ibporderers.yaml @@ -1,20 +1,3 @@ -# -# Copyright contributors to the Hyperledger Fabric Operator project -# -# SPDX-License-Identifier: Apache-2.0 -# -# 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: apiextensions.k8s.io/v1 kind: CustomResourceDefinition diff --git a/config/crd/bases/ibp.com_ibppeers.yaml b/config/crd/bases/ibp.com_ibppeers.yaml index 81d441d6..7380666b 100644 --- a/config/crd/bases/ibp.com_ibppeers.yaml +++ b/config/crd/bases/ibp.com_ibppeers.yaml @@ -1,20 +1,3 @@ -# -# Copyright contributors to the Hyperledger Fabric Operator project -# -# SPDX-License-Identifier: Apache-2.0 -# -# 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: apiextensions.k8s.io/v1 kind: CustomResourceDefinition diff --git a/go.sum b/go.sum index 500a79a7..4649a870 100644 --- a/go.sum +++ b/go.sum @@ -444,7 +444,6 @@ github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= -github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= diff --git a/release_notes/v1.0.0.md b/release_notes/v1.0.0.md new file mode 100644 index 00000000..83346571 --- /dev/null +++ b/release_notes/v1.0.0.md @@ -0,0 +1,21 @@ +v1.0.0-beta +------------------------ + +Release Notes +------------- + +Known Vulnerabilities +--------------------- +none + +Resolved Vulnerabilities +------------------------ +none + +Known Issues & Workarounds +-------------------------- +none + +Change Log +---------- +none diff --git a/release_notes/v1.0.4.md b/release_notes/v1.0.4.md new file mode 100644 index 00000000..be62dc67 --- /dev/null +++ b/release_notes/v1.0.4.md @@ -0,0 +1,21 @@ +v1.0.4 +------------------------ + +Release Notes +------------- + +Known Vulnerabilities +--------------------- +none + +Resolved Vulnerabilities +------------------------ +none + +Known Issues & Workarounds +-------------------------- +none + +Change Log +---------- +none diff --git a/scripts/install-tools.sh b/scripts/install-tools.sh index 8949ef44..ef625853 100755 --- a/scripts/install-tools.sh +++ b/scripts/install-tools.sh @@ -28,14 +28,13 @@ ## getOperatorSDK sudo rm /usr/local/bin/operator-sdk || true -sdkVersion="1.16.0" -sdkName="operator-sdk" +OPERATOR_SDK_VERSION="v1.24.1" +ARCH=$(go env GOARCH) +OS=$(go env GOOS) +URL="https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk_${OS}_${ARCH}" -url="https://github.com/operator-framework/operator-sdk/releases/download/${sdkVersion}/operator-sdk_linux_amd64" -echo "Installing operator-sdk version $sdkVersion with name of $sdkName" -wget --quiet --progress=dot:giga -t 2 -T 60 -O $sdkName $url || true -sudo mkdir -p /usr/local/bin/ -chmod +x $sdkName -./$sdkName version -sudo mv $sdkName /usr/local/bin +echo "Installing operator-sdk version ${OPERATOR_SDK_VERSION} to /usr/local/bin/operator-sdk" +curl -sL $URL > operator-sdk +chmod +x operator-sdk +sudo mv operator-sdk /usr/local/bin operator-sdk version \ No newline at end of file