Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 200 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
# this file includes an extra end-to-end test which is required to pass
# for PRs made to any release branch (i.e. a branch whose name follows semantic versioning)

name: Validate IPFS Operator For Release
on:
push:
branches: ["release*"]
tags: ["*"]
pull_request:
branches: ["release*"]

env:
GO_VERSION: "1.18"
GO111MODULE: "on"
OPERATOR_IMAGE: "quay.io/redhat-et-ipfs/ipfs-operator"
BUNDLE_IMAGE: "quay.io/redhat-et-ipfs/ipfs-operator-bundle"
TAG: "v0.0.1"

jobs:
build-operator:
name: Build-operator
runs-on: ubuntu-20.04

steps:
- name: Checkout source
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}

- name: Test
run: make test

- name: Build operator container
run: make docker-build IMG="${OPERATOR_IMAGE}"

- name: Export container image
run: docker save -o /tmp/operator.tar ${OPERATOR_IMAGE}

- name: Save container as artifact
uses: actions/upload-artifact@v1
with:
name: ipfs-cluster-operator
path: /tmp/operator.tar

build-bundle:
name: Build-Bundle
runs-on: ubuntu-20.04

steps:
- name: Checkout source
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}

- name: Install operator-sdk
run: |
curl -L -o operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v1.11.0/operator-sdk_linux_amd64
sudo install ./operator-sdk /usr/local/bin && rm operator-sdk

- name: Make bundle
run: make bundle

- name: Build bundle
run: make bundle-build

- name: Export container image
run: docker save -o /tmp/bundle.tar ${BUNDLE_IMAGE}

- name: Save container as artifact
uses: actions/upload-artifact@v1
with:
name: operator-bundle
path: /tmp/bundle.tar

e2e-release:
name: End-to-end tests
needs: [ build-bundle, build-operator ]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Install the Kubectl binary
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install ./kubectl /usr/local/bin/
kubectl version --short --client


- name: Install the Kind binary
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.12.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind version

- name: Create a Kind Cluster
run: ./hack/setup-kind-cluster.sh

- name: Pull the Container Image from Artifacts
uses: actions/download-artifact@v1
with:
name: ipfs-cluster-operator
path: /tmp

- name: Load the Container Image
run: |
docker load -i /tmp/operator.tar
docker inspect ${OPERATOR_IMAGE}
docker tag ${OPERATOR_IMAGE} ${OPERATOR_IMAGE}:ci-build
kind load docker-image ${OPERATOR_IMAGE}:ci-build

- name: Load the Operator into Kind
run: |
helm upgrade --install \
--debug \
--set image.tag="ci-build" \
--wait --timeout=300s \
ipfs-cluster ./helm/ipfs-operator

- name: run e2e tests
shell: bash
run: |
mkdir bin
make test-e2e-release

push-operator:
name: Push operator container to registry
needs: e2e-release
if: >
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-20.04
steps:
- name: Pull the Container Image from Artifacts
uses: actions/download-artifact@v1
with:
name: ipfs-cluster-operator
path: /tmp

- name: Load the Container Image
run: |
docker load -i /tmp/operator.tar
docker inspect ${OPERATOR_IMAGE}

- name: Login to registry
# If the registry server is specified in the image name, we use that.
# If the server isn't in the image name, default to docker.io
run: |
[[ "${OPERATOR_IMAGE}" =~ ^([^/]+)/[^/]+/[^/]+ ]] && REGISTRY="${BASH_REMATCH[1]}" || REGISTRY="docker.io"
echo "Attempting docker login to: ${REGISTRY}"
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin ${REGISTRY}
- name: Push to registry (version tag)
if: >
(github.event_name == 'push' || github.event_name == 'schedule') &&
github.ref == 'refs/heads/main'
run: |
docker tag ${OPERATOR_IMAGE} ${OPERATOR_IMAGE}:${TAG}
docker push "${OPERATOR_IMAGE}:${TAG}"

push-bundle:
name: Push bundle container to registry
needs: e2e-release
if: >
(github.event_name == 'push' || github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-20.04

steps:
- name: Load container artifact
uses: actions/download-artifact@v1
with:
name: operator-bundle
path: /tmp

- name: Import container image
run: |
docker load -i /tmp/bundle.tar
docker inspect "${BUNDLE_IMAGE}:${{ env.TAG }}"

- name: Login to registry
# If the registry server is specified in the image name, we use that.
# If the server isn't in the image name, default to docker.io
run: |
[[ "${BUNDLE_IMAGE}" =~ ^([^/]+)/[^/]+/[^/]+ ]] && REGISTRY="${BASH_REMATCH[1]}" || REGISTRY="docker.io"
echo "Attempting docker login to: ${REGISTRY}"
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin ${REGISTRY}

- name: Push to registry (version tag)
if: >
(github.event_name == 'push' || github.event_name == 'schedule') &&
github.ref == 'refs/heads/main'
run: |
echo "Pushing to ${{ env.TAG }}"
docker push "${BUNDLE_IMAGE}:${{ env.TAG }}"
5 changes: 2 additions & 3 deletions .github/workflows/validate-ipfs.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Validate Ipfs
on:
push:
branches: ["main", "release*"]
tags: ["*"]
branches: ["main"]
pull_request:
branches: ["main", "release*"]
branches: ["main"]

env:
GO_VERSION: "1.18"
Expand Down
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# set binary versions
GOLANGCI_VERSION := v1.46.1
HELM_VERSION := v3.8.2
KUTTL_VERSION := 0.10.0
KUTTL_VERSION := 0.15.0
GINKGO_VERSION := v2.7.0


OS := $(shell go env GOOS)
ARCH := $(shell go env GOARCH)
SYS_ARCH := $(shell uname -m)

# VERSION defines the project version for the bundle.
# Update this value when you upgrade the version of your project.
Expand Down Expand Up @@ -137,10 +138,14 @@ test: lint manifests generate fmt vet lint envtest ginkgo ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" $(GINKGO) run $(GINKGO_ARGS) $(GINKGO_TARGETS)

.PHONY: test-e2e
test-e2e: kuttl ## Run e2e tests. Requires cluster w/ Scribe already installed
cd test-kuttl && $(KUTTL) test
test-e2e: kuttl ## Run e2e tests. Requires cluster w/ IPFS Operator already installed.
cd test-kuttl && $(KUTTL) test --config kuttl-test.yaml
rm -f test-kuttl/kubeconfig

.PHONY: test-e2e-release
test-e2e-release: kuttl
cd test-kuttl && $(KUTTL) test --config kuttl-test-release.yaml

##@ Build

.PHONY: build
Expand Down Expand Up @@ -317,8 +322,9 @@ endef

.PHONY: kuttl
KUTTL := $(LOCALBIN)/kuttl
KUTTL_URL := https://github.com/kudobuilder/kuttl/releases/download/v$(KUTTL_VERSION)/kubectl-kuttl_$(KUTTL_VERSION)_linux_x86_64
kuttl: ## Download kuttl
KUTTL_URL := https://github.com/kudobuilder/kuttl/releases/download/v$(KUTTL_VERSION)/kubectl-kuttl_$(KUTTL_VERSION)_$(OS)_$(SYS_ARCH)
kuttl: $(KUTTL) ## Download kuttl
$(KUTTL): $(LOCALBIN)
$(call download-tool,$(KUTTL),$(KUTTL_URL))

.PHONY: ginkgo
Expand Down
2 changes: 1 addition & 1 deletion bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=ipfs-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.22.0
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.26.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

Expand Down
8 changes: 0 additions & 8 deletions bundle/manifests/cluster.ipfs.io_ipfsclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ spec:
required:
- circuitRelays
type: object
public:
description: public determines whether or not we should be exposing
this IPFS Cluster to the public.
type: boolean
replicas:
description: replicas sets the number of replicas of IPFS Cluster
nodes we should be running.
Expand All @@ -128,15 +124,11 @@ spec:
- roots
type: string
type: object
url:
description: url defines the URL to be using as an ingress controller.
type: string
required:
- clusterStorage
- follows
- ipfsStorage
- networking
- public
- replicas
type: object
status:
Expand Down
3 changes: 2 additions & 1 deletion bundle/manifests/ipfs-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ metadata:
}
]
capabilities: Basic Install
operators.operatorframework.io/builder: operator-sdk-v1.22.0
createdAt: "2023-01-19T17:29:48Z"
operators.operatorframework.io/builder: operator-sdk-v1.26.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
name: ipfs-operator.v0.0.1
namespace: placeholder
Expand Down
2 changes: 1 addition & 1 deletion bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ annotations:
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: ipfs-operator
operators.operatorframework.io.bundle.channels.v1: alpha
operators.operatorframework.io.metrics.builder: operator-sdk-v1.22.0
operators.operatorframework.io.metrics.builder: operator-sdk-v1.26.0
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
labels: {}
name: circuitrelays.cluster.ipfs.io
spec:
group: cluster.ipfs.io
Expand Down
Loading