Skip to content

Commit

Permalink
ci: enable deploy dev image (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
whg517 authored Aug 29, 2024
1 parent 0893901 commit 07fe424
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 85 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/e2e.yml

This file was deleted.

113 changes: 75 additions & 38 deletions .github/workflows/ci.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
name: CI
name: main

on: ['push', 'pull_request']

jobs:

golang-test:
name: Golang Test
markdown-lint:
name: Markdown Lint
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: ['1.22']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
- name: Checkout Code
uses: actions/checkout@v3
with:
go-version: ${{ matrix.go-version }}
- name: Display Go version
run: go version
- name: Install dependencies
run: go get ./...
- name: Test with Go
run: make test
fetch-depth: 0
- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_MARKDOWN: true
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: /
MARKDOWN_CONFIG_FILE: .markdownlint.yml


golang-lint:
name: Golang Lint
Expand Down Expand Up @@ -69,32 +65,70 @@ jobs:
# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"

markdown-lint:
name: Markdown Lint

golang-test:
name: Golang Test
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: ['1.22']
steps:
- name: Checkout Code
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_MARKDOWN: true
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: /
MARKDOWN_CONFIG_FILE: .markdownlint.yml
fetch-depth: 1
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Display Go version
run: go version
- name: Install dependencies
run: go get ./...
- name: Test with Go
run: make test


chainsaw-test:
name: Chainsaw Test
runs-on: ubuntu-22.04
strategy:
matrix:
k8s-version: ['1.26.14', '1.27.11']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.22'
cache: false
- name: Create KinD cluster
env:
KINDTEST_K8S_VERSION: ${{ matrix.k8s-version}}
KUBECONFIG: kind-kubeconfig-${{ matrix.k8s-version }}
KIND_KUBECONFIG: kind-kubeconfig-${{ matrix.k8s-version }}
run: make kind-create
- name: Chainsaw test setup
env:
KINDTEST_K8S_VERSION: ${{ matrix.k8s-version }}
KUBECONFIG: kind-kubeconfig-${{ matrix.k8s-version }}
KIND_KUBECONFIG: kind-kubeconfig-${{ matrix.k8s-version }}
run: make chainsaw-setup
- name: Test with Chainsaw
env:
KINDTEST_K8S_VERSION: ${{ matrix.k8s-version }}
KUBECONFIG: kind-kubeconfig-${{ matrix.k8s-version }}
KIND_KUBECONFIG: kind-kubeconfig-${{ matrix.k8s-version }}
run: make chainsaw-test


deploy-operator:
name: Deploy operator
if: github.event_name == 'push' && github.ref_type == 'tag' && github.repository_owner == 'zncdatadev'
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'zncdatadev' }}
runs-on: ubuntu-22.04
needs:
- golang-test
- markdown-lint
- golang-lint
- golang-test
- chainsaw-test
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -111,11 +145,14 @@ jobs:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push operator
run: |
make docker-buildx
- name: Build and push operator bundle
run: |
make bundle
make bundle-buildx
- name: Build and push catalog
run: |
make catalog
make catalog-buildx
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -300,26 +300,26 @@ endif
# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0).
CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:latest

.PHONY: catalog-build
catalog-build: opm ## Build a catalog manifests.
.PHONY: catalog
catalog: opm ## Build a catalog manifests.
mkdir -p catalog
@if ! test -f ./catalog.Dockerfile; then \
$(OPM) generate dockerfile catalog; \
fi
sed -E "s|(image: ).*-bundle:v$(VERSION)|\1$(BUNDLE_IMG)|g" catalog-template.yaml | \
$(OPM) alpha render-template basic -o yaml > catalog/catalog.yaml

.PHONY: catalog-docker-build
catalog-docker-build: ## Build a catalog image.
.PHONY: catalog-build
catalog-build: ## Build a catalog image.
$(CONTAINER_TOOL) build -t ${CATALOG_IMG} -f catalog.Dockerfile .

# Push the catalog image.
.PHONY: catalog-docker-push
catalog-docker-push: ## Push a catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)

.PHONY: catalog-docker-buildx
catalog-docker-buildx: ## Build and push a catalog image for cross-platform support
.PHONY: catalog-buildx
catalog-buildx: ## Build and push a catalog image for cross-platform support
- $(CONTAINER_TOOL) buildx create --name project-v3-builder
$(CONTAINER_TOOL) buildx use project-v3-builder
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) -f catalog.Dockerfile --tag ${CATALOG_IMG} .
Expand Down
4 changes: 2 additions & 2 deletions catalog-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ schema: olm.channel
package: zookeeper-operator
name: stable
entries:
- name: zookeeper-operator.v0.0.1
- name: zookeeper-operator.v0.0.0-dev
---
schema: olm.bundle
image: quay.io/zncdatadev/zookeeper-operator-bundle:v0.0.1
image: quay.io/zncdatadev/zookeeper-operator-bundle:0.0.0-dev

0 comments on commit 07fe424

Please sign in to comment.