Skip to content

Commit

Permalink
Merge pull request #30 from rgdoliveira/sync_main
Browse files Browse the repository at this point in the history
Sync main branch with Apache main branch
  • Loading branch information
rgdoliveira authored Apr 16, 2024
2 parents b08d9c7 + 1c15fcd commit 9ef97e2
Show file tree
Hide file tree
Showing 123 changed files with 1,434 additions and 12,678 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/check-container-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

env:
REGISTRY_STORAGE_DELETE_ENABLED : true
GO_VERSION: 1.21

jobs:
unit-tests:
Expand All @@ -29,11 +30,12 @@ jobs:
libbtrfs-dev \
libdevmapper-dev
- name: Setup golang
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
Expand Down Expand Up @@ -63,11 +65,11 @@ jobs:
libbtrfs-dev \
libdevmapper-dev
- name: Setup golang
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run integration tests
Expand Down
54 changes: 25 additions & 29 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: PR checks

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
Expand All @@ -23,28 +24,26 @@ jobs:
name: Unit tests And Coverage
runs-on: ubuntu-latest
steps:
# Packages for testing with Podman
- name: Install package
run: |
sudo apt-get update &&\
sudo apt-get -y install --no-install-recommends \
btrfs-progs \
libgpgme-dev \
libbtrfs-dev \
libdevmapper-dev
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install Go
id: go
uses: actions/setup-go@v3
- name: Setup Go and Install Packages
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Install Additional Packages
run: |
sudo apt-get update && \
sudo apt-get -y install --no-install-recommends \
btrfs-progs \
libgpgme-dev \
libbtrfs-dev \
libdevmapper-dev
- name: Run tests
run: make test test-workflowproj

Expand All @@ -61,11 +60,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Go
id: go
uses: actions/setup-go@v3
- name: Setup Go and Install Packages
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
Expand All @@ -85,25 +83,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

# since we now have to download container-builder deps, we need these packages installed before generating our types.
- name: Install packages
- name: Setup Go and Install Packages
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Install Additional Packages
run: |
sudo apt-get update &&\
sudo apt-get update && \
sudo apt-get -y install --no-install-recommends \
btrfs-progs \
libgpgme-dev \
libbtrfs-dev \
libdevmapper-dev
- name: Install Go
id: go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Check generations
run: |
make generate-all
Expand Down
54 changes: 30 additions & 24 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: E2E checks

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
Expand All @@ -13,7 +14,9 @@ on:

env:
GO_VERSION: 1.21
PYTHON_VERSION: "3.10"
KIND_VERSION: v0.20.0
OPERATOR_IMAGE_NAME: "127.0.0.1:5001/kogito-serverless-operator:0.0.1"

jobs:
e2e:
Expand All @@ -24,58 +27,61 @@ jobs:
runs-on: ubuntu-latest
name: End-to-end tests (Kind)
steps:
- name: Install package
- name: Install dependencies
run: |
sudo apt-get update &&\
sudo apt-get -y install --no-install-recommends \
btrfs-progs \
libgpgme-dev \
libbtrfs-dev \
libdevmapper-dev \
libkrb5-dev
sudo apt-get update && \
sudo apt-get -y install --no-install-recommends \
btrfs-progs \
libgpgme-dev \
libbtrfs-dev \
libdevmapper-dev \
libkrb5-dev
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Setup Kind cluster
run: |
make KIND_VERSION=${{ env.KIND_VERSION }} create-cluster
- name: Setup Python for cekit
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache-dependency-path: images/requirements.txt
cache: 'pip'

- name: Set OPERATOR_IMAGE_NAME to point to Kind's local registry
- name: Install Cekit
run: |
echo "OPERATOR_IMAGE_NAME=127.0.0.1:5001/kogito-serverless-operator:0.0.1" >> $GITHUB_ENV
pip install -r images/requirements.txt
cekit --version
- name: Build operator image
run: |
make docker-build IMG=${{ env.OPERATOR_IMAGE_NAME }}
- name: Setup Kind cluster
run: make KIND_VERSION=${{ env.KIND_VERSION }} create-cluster

- name: Set OPERATOR_IMAGE_NAME to point to Kind's local registry
run: echo "OPERATOR_IMAGE_NAME=${{ env.OPERATOR_IMAGE_NAME }}" >> $GITHUB_ENV

- name: Load image in Kind
- name: Build and load operator image
run: |
kind load docker-image 127.0.0.1:5001/kogito-serverless-operator:0.0.1
make container-build BUILDER=docker IMG=${{ env.OPERATOR_IMAGE_NAME }}
kind load docker-image ${{ env.OPERATOR_IMAGE_NAME }}
- name: Check pods
run: |
kubectl version
kubectl get pods -A
# TODO: install the operator-sdk first, then cache the installation

- name: Deploy operator
run: |
make deploy IMG=${{ env.OPERATOR_IMAGE_NAME }}
kubectl wait pod -A -l control-plane=sonataflow-operator --for condition=Ready
- name: Run tests
run: |
make test-e2e
run: make test-e2e

- name: Retrieve cluster events and list pods
if: failure()
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# These files are generated by Cekit, we can ignore the operator-sdk ones.
bundle.Dockerfile
Dockerfile

.DS_Store

# Binaries for programs and plugins
Expand Down
60 changes: 0 additions & 60 deletions Dockerfile

This file was deleted.

33 changes: 10 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,7 @@ run: manifests generate ## Run a controller from your host.

.PHONY: debug
debug: build-4-debug ## Run a controller from your host from binary
./bin/manager -v=2

.PHONY: docker-build
docker-build: generate ## Build docker image with the manager.
docker build --build-arg SOURCE_DATE_EPOCH="$(shell git log -1 --pretty=%ct)" -t ${IMG} .

.PHONY: podman-build
podman-build: generate ## Build container image with the manager.
podman build --build-arg SOURCE_DATE_EPOCH="$(shell git log -1 --pretty=%ct)" -t ${IMG} .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
docker push ${IMG}
./bin/manager -v=2 -controller-cfg-path=$(CURDIR)/config/manager/controllers_cfg.yaml

# This is currently done directly into the CI
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
Expand All @@ -190,15 +178,11 @@ docker-buildx: generate ## Build and push docker image for the manager for cross
- docker buildx rm project-v3-builder
rm Dockerfile.cross

.PHONY: podman-push
podman-push: ## Push container image with the manager.
podman push ${PODMAN_PUSH_PARAMS} ${IMG}

.PHONY: container-build
container-build: test ## Build the container image
cekit -v --descriptor image.yaml build ${build_options} $(BUILDER)
container-build: ## Build the container image
cekit -v --descriptor images/manager.yaml build ${build_options} $(BUILDER) --build-arg SOURCE_DATE_EPOCH="$(shell git log -1 --pretty=%ct)"
ifneq ($(ignore_tag),true)
$(BUILDER) tag kogito-serverless-operator ${IMG}
$(BUILDER) tag sonataflow-operator:latest ${IMG}
endif

.PHONY: container-push
Expand Down Expand Up @@ -274,8 +258,11 @@ bundle: manifests kustomize install-operator-sdk ## Generate bundle manifests an
operator-sdk bundle validate ./bundle

.PHONY: bundle-build
bundle-build: ## Build the bundle image.
$(BUILDER) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
bundle-build: ## Build the bundle image
cekit -v --descriptor images/bundle.yaml build ${build_options} $(BUILDER) --no-squash --build-arg SOURCE_DATE_EPOCH="$(shell git log -1 --pretty=%ct)"
ifneq ($(ignore_tag),true)
$(BUILDER) tag sonataflow-operator-bundle:latest $(BUNDLE_IMG)
endif

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
Expand Down Expand Up @@ -346,7 +333,7 @@ addheaders:
generate-all: generate generate-deploy bundle addheaders vet fmt

.PHONY: test-e2e # You will need to have a Minikube/Kind cluster up in running to run this target, and run container-builder before the test
test-e2e: install-operator-sdk
test-e2e:
go test ./test/e2e/* -v -ginkgo.v -ginkgo.no-color -ginkgo.junit-report=./e2e-test-report.xml -timeout 60m

.PHONY: before-pr
Expand Down
Loading

0 comments on commit 9ef97e2

Please sign in to comment.