Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update kubebuilder version and update ci #17

Merged
merged 5 commits into from
Jan 27, 2024
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
51 changes: 4 additions & 47 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
bin/
testbin/
### VisualStudioCode template
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
.vscode

# Local History for Visual Studio Code
.history/
Expand All @@ -17,47 +12,7 @@ testbin/
*.vsix

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
.idea

# CMake
cmake-build-*/
Expand Down Expand Up @@ -164,3 +119,5 @@ Network Trash Folder
Temporary Items
.apdisk

bundle
bundle.Dockerfile
158 changes: 63 additions & 95 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,110 +1,78 @@
# 定义工作流的名称
name: CI

on:
workflow_dispatch: # 允许手动触发工作流
push: # 当有代码推送事件发生时
branches:
- main # 只有推送到 main 分支时才触发
tags:
- '*'
pull_request:
on: ['push', 'pull_request']


# 定义工作流的任务
jobs:
build:
# 定义运行此任务的环境:最新版本的 ubuntu
runs-on: ubuntu-latest

# 定义任务中的步骤
test:
runs-on: ubuntu-22.04
strategy:
matrix:
go-version: ['1.20', '1.21.x']
steps:
# 检出代码。只检出最新的1次提交
- uses: actions/checkout@v3
with:
fetch-depth: 1

# 设置 QEMU 模拟器,这通常用于多平台的 Docker 构建
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- uses: actions/checkout@v3
with:
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: go test ./... -json > TestResults-${{ matrix.go-version }}.json
- name: Upload Go test results
uses: actions/upload-artifact@v4
with:
name: Go-results-${{ matrix.go-version }}
path: TestResults-${{ matrix.go-version }}.json

# 设置 Docker Buildx,用于构建多平台的 Docker 镜像
- name: Set up Build
uses: docker/setup-buildx-action@v2
- run: |
make build

linting:
name: Lint Code Base
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
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 }}
- name: Checkout Code
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

LINTER_RULES_PATH: /
MARKDOWN_CONFIG_FILE: .markdownlint.yml

main:
deploy-quay:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'zncdata-labs/spark-k8s-operator'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs:
- build
- linting

steps:
# 检出代码。只检出最新的1次提交
- uses: actions/checkout@v3
with:
fetch-depth: 1

# 登录到 QUAY Hub
- name: Login to quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }} # 使用存储在 GitHub Secrets 中的 QUAY 用户名
password: ${{ secrets.QUAY_PASSWORD }} # 使用存储在 GitHub Secrets 中的 QUAY 密码

- name: Build and push Docker image
run: |
make docker-buildx
make bundle
make bundle-buildx

tags:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'zncdata-labs/spark-k8s-operator'
runs-on: ubuntu-latest
needs:
- build
- linting

- test
- linting
steps:
# 检出代码。只检出最新的1次提交
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

# 登录到 QUAY Hub
- name: Login to quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }} # 使用存储在 GitHub Secrets 中的 QUAY 用户名
password: ${{ secrets.QUAY_PASSWORD }} # 使用存储在 GitHub Secrets 中的 QUAY 密码
- name: Build and push operator
run: |
make docker-buildx

- name: Build and push Docker image
run: |
export VERSION=$GITHUB_REF_NAME
make docker-buildx
make bundle
make bundle-buildx
- name: Build and push operator bundle
run: |
make bundle
make bundle-buildx
56 changes: 7 additions & 49 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ Dockerfile.cross
*.swo
*~

# olm
bundle### VisualStudioCode template
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
### VisualStudioCode template
.vscode

# Local History for Visual Studio Code
.history/
Expand All @@ -41,47 +35,7 @@ bundle### VisualStudioCode template
*.vsix

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
.idea

# CMake
cmake-build-*/
Expand Down Expand Up @@ -187,3 +141,7 @@ Icon
Network Trash Folder
Temporary Items
.apdisk

# olm
bundle
bundle.Dockerfile
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: zncdata.net
layout:
- go.kubebuilder.io/v4-alpha
- go.kubebuilder.io/v4
plugins:
grafana.kubebuilder.io/v1-alpha: {}
manifests.sdk.operatorframework.io/v2: {}
Expand Down
20 changes: 0 additions & 20 deletions bundle.Dockerfile

This file was deleted.

Loading