Skip to content

Commit 17b2689

Browse files
authored
Merge pull request #7 from charlie0129/refactor-crds
Refactor: rename CRs
2 parents e8452b8 + f21fb8c commit 17b2689

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1260
-838
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ bin
6060
.github
6161
docs
6262
examples
63+
.git

.github/workflows/docs-check.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515

1616
jobs:
1717
checks:
18+
name: Check Docs
1819
runs-on: ubuntu-latest
1920
steps:
2021
- name: Install xmllint

.github/workflows/go-checks.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ env:
1818

1919
jobs:
2020
detect-noop:
21+
name: Detect No-op Changes
2122
runs-on: ubuntu-latest
2223
outputs:
2324
noop: ${{ steps.noop.outputs.should_skip }}
@@ -32,6 +33,7 @@ jobs:
3233
concurrent_skipping: false
3334

3435
checks:
36+
name: Check Go Code
3537
runs-on: ubuntu-latest
3638
needs: detect-noop
3739
if: needs.detect-noop.outputs.noop != 'true'

.github/workflows/release-binary.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414

1515
jobs:
1616
kube-trigger:
17-
name: Release kube-trigger binaries
17+
name: Release kube-trigger Binaries
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout Code
@@ -41,7 +41,7 @@ jobs:
4141
- name: Get Version
4242
id: get_version
4343
run: |
44-
export VERSION=$(./make-kt version)
44+
VERSION=$(./make-kt version)
4545
echo ::set-output name=VERSION::${VERSION}
4646
4747
- name: Build Binaries for All Platforms

.github/workflows/release-image.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
kube-trigger:
13-
name: Release kube-trigger image
13+
name: Release kube-trigger Images
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout Code
@@ -49,7 +49,7 @@ jobs:
4949
run: ./make-kt all-docker-build-push
5050

5151
manager:
52-
name: Release manager image
52+
name: Release manager Images
5353
runs-on: ubuntu-latest
5454
steps:
5555
- name: Checkout Code

.github/workflows/unit-test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ env:
1919

2020
jobs:
2121
detect-noop:
22+
name: Detect No-op Changes
2223
runs-on: ubuntu-latest
2324
outputs:
2425
noop: ${{ steps.noop.outputs.should_skip }}
@@ -33,6 +34,7 @@ jobs:
3334
concurrent_skipping: false
3435

3536
unit-test:
37+
name: Run Unit Tests and Integration Tests
3638
runs-on: ubuntu-latest
3739
needs: detect-noop
3840
if: needs.detect-noop.outputs.noop != 'true'

.github/workflows/upload-test-binary.yaml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ env:
1919

2020
jobs:
2121
detect-noop:
22+
name: Detect No-op Changes
2223
runs-on: ubuntu-latest
2324
outputs:
2425
noop: ${{ steps.noop.outputs.should_skip }}
@@ -33,9 +34,19 @@ jobs:
3334
concurrent_skipping: false
3435

3536
upload-test-binary:
37+
name: Build and Upload Test Binaries
3638
needs: detect-noop
3739
if: needs.detect-noop.outputs.noop != 'true'
3840
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
platform:
44+
- linux-amd64
45+
- darwin-amd64
46+
- darwin-arm64
47+
binary:
48+
- kube-trigger
49+
- manager
3950
steps:
4051
- name: Checkout Code
4152
uses: actions/checkout@v3
@@ -64,31 +75,19 @@ jobs:
6475
- name: Get Version
6576
id: get_version
6677
run: |
67-
export VERSION=$(./make-kt version)
78+
VERSION=$(./make-kt version)
6879
echo ::set-output name=VERSION::${VERSION}
6980
70-
- name: Build Binaries for linux and darwin
81+
- name: Build Binary
7182
env:
7283
DIRTY_BUILD: true
7384
run: |
74-
./make-kt build-linux_amd64
75-
./make-kt build-darwin_amd64
76-
./make-kt build-darwin_arm64
85+
PLATFORM=${{ matrix.platform }}
86+
BINARY=${{ matrix.binary }}
87+
make -f ${BINARY/-/}.mk build-${PLATFORM/-/_}
7788
78-
- name: Upload Artifacts (linux-amd64)
89+
- name: Upload Artifacts
7990
uses: actions/upload-artifact@v3
8091
with:
81-
name: kube-trigger-${{ steps.get_version.outputs.VERSION }}-linux-amd64
82-
path: bin/kube-trigger-${{ steps.get_version.outputs.VERSION }}/kube-trigger-*-linux-amd64
83-
84-
- name: Upload Artifacts (darwin-amd64)
85-
uses: actions/upload-artifact@v3
86-
with:
87-
name: kube-trigger-${{ steps.get_version.outputs.VERSION }}-darwin-amd64
88-
path: bin/kube-trigger-${{ steps.get_version.outputs.VERSION }}/kube-trigger-*-darwin-amd64
89-
90-
- name: Upload Artifacts (darwin-arm64)
91-
uses: actions/upload-artifact@v3
92-
with:
93-
name: kube-trigger-${{ steps.get_version.outputs.VERSION }}-darwin-arm64
94-
path: bin/kube-trigger-${{ steps.get_version.outputs.VERSION }}/kube-trigger-*-darwin-arm64
92+
name: ${{ matrix.binary }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.platform }}
93+
path: bin/${{ matrix.binary }}-${{ steps.get_version.outputs.VERSION }}/${{ matrix.binary }}-*-${{ matrix.platform }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,6 @@ bin
6060
# etcd
6161
default.etcd
6262

63+
# Generated Dockerfile
64+
# This is automatically generated by Make depending on which image you want to build.
65+
Dockerfile

Dockerfile.in

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
# limitations under the License.
1414

1515
# Note: the ${BIN} needs to be replaced with the actual binary,
16-
# otherwise it won't work. Refer to Makefile for how it can be done.
16+
# otherwise it won't work. A valid Dockerfile will be generated
17+
# using this template. Refer to Makefile for how it can be done.
18+
19+
# syntax = docker/dockerfile:1.2
20+
# You need to enable Docker BuildKit for this to work.
21+
# Also refer to Makefile for how it can be done.
1722

1823
ARG BUILD_IMAGE=golang:1.17
1924
ARG BASE_IMAGE=gcr.io/distroless/static:nonroot
@@ -27,7 +32,8 @@ COPY go.sum go.sum
2732

2833
ARG GOPROXY
2934
ENV GOPROXY=${GOPROXY}
30-
RUN go mod download
35+
RUN --mount=type=cache,target=/root/go/pkg \
36+
go mod download
3137

3238
COPY build build
3339
COPY hack hack
@@ -45,12 +51,14 @@ ARG GOFLAGS
4551
ARG DIRTY_BUILD
4652
ARG ENTRY
4753

48-
RUN ARCH=${TARGETARCH:-${ARCH:-amd64}} \
49-
OS=${TARGETOS:-${OS:-linux}} \
50-
OUTPUT=${BIN} \
51-
VERSION=${VERSION} \
52-
GOFLAGS=${GOFLAGS} \
53-
/bin/sh build/build.sh \
54+
RUN --mount=type=cache,target=/root/.cache/go-build \
55+
ARCH=${TARGETARCH:-${ARCH:-amd64}} \
56+
OS=${TARGETOS:-${OS:-linux}} \
57+
OUTPUT=${BIN} \
58+
VERSION=${VERSION} \
59+
GOFLAGS=${GOFLAGS} \
60+
DIRTY_BUILD=${DIRTY_BUILD} \
61+
/bin/sh build/build.sh \
5462
${ENTRY}
5563

5664
FROM ${BASE_IMAGE}

PROJECT

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ resources:
1010
controller: true
1111
domain: oam.dev
1212
group: standard
13-
kind: KubeTrigger
13+
kind: TriggerInstance
1414
path: github.com/kubevela/kube-trigger/api/v1alpha1
1515
version: v1alpha1
1616
- api:
@@ -19,7 +19,7 @@ resources:
1919
controller: true
2020
domain: oam.dev
2121
group: standard
22-
kind: KubeTriggerConfig
22+
kind: TriggerService
2323
path: github.com/kubevela/kube-trigger/api/v1alpha1
2424
version: v1alpha1
2525
version: "3"

0 commit comments

Comments
 (0)