Skip to content

Commit 64838b5

Browse files
authored
Initial commit
0 parents  commit 64838b5

Some content is hidden

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

68 files changed

+5505
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Bug Report
3+
about: Help us diagnose and fix bugs in Crossplane
4+
labels: bug
5+
---
6+
<!--
7+
Thank you for helping to improve Crossplane!
8+
9+
Please be sure to search for open issues before raising a new one. We use issues
10+
for bug reports and feature requests. Please find us at https://slack.crossplane.io
11+
for questions, support, and discussion.
12+
-->
13+
14+
### What happened?
15+
<!--
16+
Please let us know what behaviour you expected and how Crossplane diverged from
17+
that behaviour.
18+
-->
19+
20+
21+
### How can we reproduce it?
22+
<!--
23+
Help us to reproduce your bug as succinctly and precisely as possible. Artifacts
24+
such as example manifests or a script that triggers the issue are highly
25+
appreciated!
26+
-->
27+
28+
### What environment did it happen in?
29+
Crossplane version:
30+
31+
<!--
32+
Include at least the version or commit of Crossplane you were running. Consider
33+
also including your:
34+
35+
* Cloud provider or hardware configuration
36+
* Kubernetes version (use `kubectl version`)
37+
* Kubernetes distribution (e.g. Tectonic, GKE, OpenShift)
38+
* OS (e.g. from /etc/os-release)
39+
* Kernel (e.g. `uname -a`)
40+
-->
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature Request
3+
about: Help us make Crossplane more useful
4+
labels: enhancement
5+
---
6+
<!--
7+
Thank you for helping to improve Crossplane!
8+
9+
Please be sure to search for open issues before raising a new one. We use issues
10+
for bug reports and feature requests. Please find us at https://slack.crossplane.io
11+
for questions, support, and discussion.
12+
-->
13+
14+
### What problem are you facing?
15+
<!--
16+
Please tell us a little about your use case - it's okay if it's hypothetical!
17+
Leading with this context helps frame the feature request so we can ensure we
18+
implement it sensibly.
19+
--->
20+
21+
### How could Crossplane help solve your problem?
22+
<!--
23+
Let us know how you think Crossplane could help with your use case.
24+
-->

.github/PULL_REQUEST_TEMPLATE.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!--
2+
Thank you for helping to improve Crossplane!
3+
4+
Please read through https://git.io/fj2m9 if this is your first time opening a
5+
Crossplane pull request. Find us in https://slack.crossplane.io/messages/dev if
6+
you need any help contributing.
7+
-->
8+
9+
### Description of your changes
10+
11+
<!--
12+
Briefly describe what this pull request does. Be sure to direct your reviewers'
13+
attention to anything that needs special consideration.
14+
15+
We love pull requests that resolve an open Crossplane issue. If yours does, you
16+
can uncomment the below line to indicate which issue your PR fixes, for example
17+
"Fixes #500":
18+
19+
-->
20+
Fixes #
21+
22+
I have:
23+
24+
- [ ] Read and followed Crossplane's [contribution process].
25+
- [ ] Run `make reviewable` to ensure this PR is ready for review.
26+
- [ ] Added `backport release-x.y` labels to auto-backport this PR if necessary.
27+
28+
### How has this code been tested
29+
30+
<!--
31+
Before reviewers can be confident in the correctness of this pull request, it
32+
needs to tested and shown to be correct. Briefly describe the testing that has
33+
already been done or which is planned for this change.
34+
-->
35+
36+
[contribution process]: https://git.io/fj2m9

.github/workflows/backport.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Backport
2+
3+
on:
4+
# NOTE(negz): This is a risky target, but we run this action only when and if
5+
# a PR is closed, then filter down to specifically merged PRs. We also don't
6+
# invoke any scripts, etc from within the repo. I believe the fact that we'll
7+
# be able to review PRs before this runs makes this fairly safe.
8+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
9+
pull_request_target:
10+
types: [closed]
11+
# See also commands.yml for the /backport triggered variant of this workflow.
12+
13+
jobs:
14+
# NOTE(negz): I tested many backport GitHub actions before landing on this
15+
# one. Many do not support merge commits, or do not support pull requests with
16+
# more than one commit. This one does. It also handily links backport PRs with
17+
# new PRs, and provides commentary and instructions when it can't backport.
18+
# The main gotcha with this action is that PRs _must_ be labelled before they're
19+
# merged to trigger a backport.
20+
open-pr:
21+
runs-on: ubuntu-22.04
22+
if: github.event.pull_request.merged
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Open Backport PR
28+
uses: korthout/backport-action@v1

.github/workflows/ci.yml

+250
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release-*
8+
pull_request: {}
9+
workflow_dispatch: {}
10+
11+
env:
12+
# Common versions
13+
GO_VERSION: '1.20'
14+
GOLANGCI_VERSION: 'v1.54.0'
15+
DOCKER_BUILDX_VERSION: 'v0.9.1'
16+
17+
# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a
18+
# step 'if env.XXX' != ""', so we copy these to succinctly test whether
19+
# credentials have been provided before trying to run steps that need them.
20+
UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
21+
jobs:
22+
detect-noop:
23+
runs-on: ubuntu-22.04
24+
outputs:
25+
noop: ${{ steps.noop.outputs.should_skip }}
26+
steps:
27+
- name: Detect No-op Changes
28+
id: noop
29+
uses: fkirc/skip-duplicate-actions@v5.2.0
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
paths_ignore: '["**.md", "**.png", "**.jpg"]'
33+
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
34+
35+
36+
lint:
37+
runs-on: ubuntu-22.04
38+
needs: detect-noop
39+
if: needs.detect-noop.outputs.noop != 'true'
40+
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v2
44+
with:
45+
submodules: true
46+
47+
- name: Setup Go
48+
uses: actions/setup-go@v2
49+
with:
50+
go-version: ${{ env.GO_VERSION }}
51+
52+
- name: Find the Go Build Cache
53+
id: go
54+
run: echo "::set-output name=cache::$(make go.cachedir)"
55+
56+
- name: Cache the Go Build Cache
57+
uses: actions/cache@v2
58+
with:
59+
path: ${{ steps.go.outputs.cache }}
60+
key: ${{ runner.os }}-build-lint-${{ hashFiles('**/go.sum') }}
61+
restore-keys: ${{ runner.os }}-build-lint-
62+
63+
- name: Cache Go Dependencies
64+
uses: actions/cache@v2
65+
with:
66+
path: .work/pkg
67+
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
68+
restore-keys: ${{ runner.os }}-pkg-
69+
70+
- name: Vendor Dependencies
71+
run: make vendor vendor.check
72+
73+
# We could run 'make lint' but we prefer this action because it leaves
74+
# 'annotations' (i.e. it comments on PRs to point out linter violations).
75+
- name: Lint
76+
uses: golangci/golangci-lint-action@v3
77+
with:
78+
version: ${{ env.GOLANGCI_VERSION }}
79+
80+
check-diff:
81+
runs-on: ubuntu-22.04
82+
needs: detect-noop
83+
if: needs.detect-noop.outputs.noop != 'true'
84+
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@v2
88+
with:
89+
submodules: true
90+
91+
- name: Setup Go
92+
uses: actions/setup-go@v2
93+
with:
94+
go-version: ${{ env.GO_VERSION }}
95+
96+
- name: Find the Go Build Cache
97+
id: go
98+
run: echo "::set-output name=cache::$(make go.cachedir)"
99+
100+
- name: Cache the Go Build Cache
101+
uses: actions/cache@v2
102+
with:
103+
path: ${{ steps.go.outputs.cache }}
104+
key: ${{ runner.os }}-build-check-diff-${{ hashFiles('**/go.sum') }}
105+
restore-keys: ${{ runner.os }}-build-check-diff-
106+
107+
- name: Cache Go Dependencies
108+
uses: actions/cache@v2
109+
with:
110+
path: .work/pkg
111+
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
112+
restore-keys: ${{ runner.os }}-pkg-
113+
114+
- name: Vendor Dependencies
115+
run: make vendor vendor.check
116+
117+
- name: Check Diff
118+
id: check-diff
119+
run: |
120+
mkdir _output
121+
make check-diff
122+
123+
- name: Show diff
124+
if: failure() && steps.check-diff.outcome == 'failure'
125+
run: git diff
126+
127+
unit-tests:
128+
runs-on: ubuntu-22.04
129+
needs: detect-noop
130+
if: needs.detect-noop.outputs.noop != 'true'
131+
132+
steps:
133+
- name: Checkout
134+
uses: actions/checkout@v2
135+
with:
136+
submodules: true
137+
138+
- name: Fetch History
139+
run: git fetch --prune --unshallow
140+
141+
- name: Setup Go
142+
uses: actions/setup-go@v2
143+
with:
144+
go-version: ${{ env.GO_VERSION }}
145+
146+
- name: Find the Go Build Cache
147+
id: go
148+
run: echo "::set-output name=cache::$(make go.cachedir)"
149+
150+
- name: Cache the Go Build Cache
151+
uses: actions/cache@v2
152+
with:
153+
path: ${{ steps.go.outputs.cache }}
154+
key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }}
155+
restore-keys: ${{ runner.os }}-build-unit-tests-
156+
157+
- name: Cache Go Dependencies
158+
uses: actions/cache@v2
159+
with:
160+
path: .work/pkg
161+
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
162+
restore-keys: ${{ runner.os }}-pkg-
163+
164+
- name: Vendor Dependencies
165+
run: make vendor vendor.check
166+
167+
- name: Run Unit Tests
168+
run: make -j2 test
169+
170+
- name: Publish Unit Test Coverage
171+
uses: codecov/codecov-action@v1
172+
with:
173+
flags: unittests
174+
file: _output/tests/linux_amd64/coverage.txt
175+
176+
publish-artifacts:
177+
runs-on: ubuntu-22.04
178+
needs: detect-noop
179+
if: needs.detect-noop.outputs.noop != 'true'
180+
181+
steps:
182+
- name: Setup QEMU
183+
uses: docker/setup-qemu-action@v1
184+
with:
185+
platforms: all
186+
187+
- name: Setup Docker Buildx
188+
uses: docker/setup-buildx-action@v1
189+
with:
190+
version: ${{ env.DOCKER_BUILDX_VERSION }}
191+
install: true
192+
193+
- name: Login to Upbound
194+
uses: docker/login-action@v1
195+
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != ''
196+
with:
197+
registry: xpkg.upbound.io
198+
username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
199+
password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }}
200+
201+
- name: Checkout
202+
uses: actions/checkout@v2
203+
with:
204+
submodules: true
205+
206+
- name: Fetch History
207+
run: git fetch --prune --unshallow
208+
209+
- name: Setup Go
210+
uses: actions/setup-go@v2
211+
with:
212+
go-version: ${{ env.GO_VERSION }}
213+
214+
- name: Find the Go Build Cache
215+
id: go
216+
run: echo "::set-output name=cache::$(make go.cachedir)"
217+
218+
- name: Cache the Go Build Cache
219+
uses: actions/cache@v2
220+
with:
221+
path: ${{ steps.go.outputs.cache }}
222+
key: ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }}
223+
restore-keys: ${{ runner.os }}-build-publish-artifacts-
224+
225+
- name: Cache Go Dependencies
226+
uses: actions/cache@v2
227+
with:
228+
path: .work/pkg
229+
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
230+
restore-keys: ${{ runner.os }}-pkg-
231+
232+
- name: Vendor Dependencies
233+
run: make vendor vendor.check
234+
235+
- name: Build Artifacts
236+
run: make -j2 build.all
237+
env:
238+
# We're using docker buildx, which doesn't actually load the images it
239+
# builds by default. Specifying --load does so.
240+
BUILD_ARGS: "--load"
241+
242+
- name: Publish Artifacts to GitHub
243+
uses: actions/upload-artifact@v3
244+
with:
245+
name: output
246+
path: _output/**
247+
248+
- name: Publish Artifacts
249+
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != ''
250+
run: make publish BRANCH_NAME=${GITHUB_REF##*/}

0 commit comments

Comments
 (0)