Skip to content

Commit e5cc1ef

Browse files
authored
Migrate configuration-gcp-database to Upbound DevEx (#77)
* Migrate to new devex Signed-off-by: Yury Tsarev <[email protected]> * Add tests for postgres Signed-off-by: Yury Tsarev <[email protected]> * Consolidate network reference in examples Signed-off-by: Yury Tsarev <[email protected]> * Refactor to cleaner defaults Signed-off-by: Yury Tsarev <[email protected]> --------- Signed-off-by: Yury Tsarev <[email protected]>
1 parent 9d44f23 commit e5cc1ef

Some content is hidden

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

41 files changed

+1036
-653
lines changed

.github/renovate.json5

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,10 @@
3939
},
4040
{
4141
matchFileNames: [
42-
'crossplane.yaml',
42+
'upbound.yaml',
4343
],
4444
groupName: 'crossplane dependencies',
4545
},
46-
{
47-
matchFileNames: [
48-
'Makefile',
49-
],
50-
groupName: 'Makefile dependencies',
51-
},
5246
{
5347
matchManagers: ['crossplane'],
5448
matchFileNames: ['examples/**'],
@@ -58,33 +52,9 @@
5852
customManagers: [
5953
{
6054
customType: 'regex',
61-
description: 'Bump up version in the Makefile',
62-
fileMatch: [
63-
'^Makefile$',
64-
],
65-
matchStrings: [
66-
'UP_VERSION = (?<currentValue>.*?)\\n',
67-
],
68-
datasourceTemplate: 'github-releases',
69-
depNameTemplate: 'upbound/up',
70-
},
71-
{
72-
customType: 'regex',
73-
description: 'Bump uptest version in the Makefile',
74-
fileMatch: [
75-
'^Makefile$',
76-
],
77-
matchStrings: [
78-
'UPTEST_VERSION = (?<currentValue>.*?)\\n',
79-
],
80-
datasourceTemplate: 'github-releases',
81-
depNameTemplate: 'upbound/uptest',
82-
},
83-
{
84-
customType: 'regex',
85-
description: 'Bump providers/functions/configurations in crossplane.yaml',
55+
description: 'Bump providers/functions/configurations in upbound.yaml',
8656
fileMatch: [
87-
'crossplane.yaml',
57+
'upbound.yaml',
8858
],
8959
matchStrings: [
9060
'#\\s*renovate:\\s*datasource=(?<datasource>[^\\s]+)\\s+depName=(?<depName>[^\\s]+)\\s*\\n\\s*version:\\s*"(?<currentValue>[^"]+)"',

.github/workflows/ci.yaml

Lines changed: 39 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,69 +4,53 @@ on:
44
push:
55
branches:
66
- main
7-
- release-*
8-
workflow_dispatch: {}
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: Package version (e.g. v0.1.0)
11+
required: false
912

1013
env:
11-
DOCKER_BUILDX_VERSION: 'v0.8.2'
12-
13-
XPKG_ACCESS_ID: ${{ secrets.XPKG_ACCESS_ID }}
14+
UP_API_TOKEN: ${{ secrets.UP_API_TOKEN }}
15+
UP_ROBOT_ID: ${{ secrets.UP_ROBOT_ID }}
16+
UP_ORG: ${{ secrets.UP_ORG }}
17+
XPKG_REGISTRY: xpkg.upbound.io
1418

1519
jobs:
16-
detect-noop:
17-
runs-on: ubuntu-24.04
18-
outputs:
19-
noop: ${{ steps.noop.outputs.should_skip }}
20-
steps:
21-
- name: Detect No-op Changes
22-
id: noop
23-
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
24-
with:
25-
github_token: ${{ secrets.GITHUB_TOKEN }}
26-
paths_ignore: '["**.md", "**.png", "**.jpg"]'
27-
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
28-
29-
publish-artifacts:
30-
runs-on: ubuntu-24.04
31-
needs: detect-noop
32-
if: needs.detect-noop.outputs.noop != 'true'
33-
20+
deploy:
21+
runs-on: ubuntu-latest
3422
steps:
35-
- name: Setup Docker Buildx
36-
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
37-
with:
38-
version: ${{ env.DOCKER_BUILDX_VERSION }}
39-
install: true
40-
4123
- name: Checkout
42-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
43-
with:
44-
submodules: true
45-
46-
- name: Fetch History
47-
run: git fetch --prune --unshallow
24+
id: checkout
25+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
4826

49-
- name: Build Artifacts
50-
run: make -j2 build.all
51-
env:
52-
# We're using docker buildx, which doesn't actually load the images it
53-
# builds by default. Specifying --load does so.
54-
BUILD_ARGS: "--load"
55-
56-
- name: Publish Artifacts to GitHub
57-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
27+
- name: Install and login with up
28+
if: env.UP_API_TOKEN != '' && env.UP_ORG != ''
29+
uses: upbound/action-up@53fe6395637d884c80d2bbc8c2d75d0ece776ced # v1
5830
with:
59-
name: output
60-
path: _output/**
31+
api-token: ${{ secrets.UP_API_TOKEN }}
32+
organization: ${{ secrets.UP_ORG }}
6133

62-
- name: Login to Upbound
63-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
64-
if: env.XPKG_ACCESS_ID != ''
34+
# doesn't work with plain token when pushing otherwise
35+
- name: Login to xpkg with robot
36+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3
6537
with:
66-
registry: xpkg.upbound.io
67-
username: ${{ secrets.XPKG_ACCESS_ID }}
68-
password: ${{ secrets.XPKG_TOKEN }}
38+
registry: ${{ env.XPKG_REGISTRY }}
39+
username: ${{ env.UP_ROBOT_ID }}
40+
password: ${{ env.UP_API_TOKEN }}
6941

70-
- name: Publish Artifacts
71-
if: env.XPKG_ACCESS_ID != ''
72-
run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/}
42+
- name: Build and Push Upbound project
43+
if: env.UP_API_TOKEN != ''
44+
uses: upbound/action-up-project@b849ec1eb303ae4abf22b2b86c0e2afca155137b # v1
45+
with:
46+
push-project: true
47+
tag: ${{ inputs.version || '' }}
48+
# login-check does `up org list` which doesn't work with a robot-token
49+
skip-login-check: true
50+
51+
- name: Append icon overlay to package
52+
if: env.UP_API_TOKEN != '' && hashFiles('./extensions') != '' && inputs.version != ''
53+
run: |
54+
PROJECT_NAME=$(yq '.metadata.name' upbound.yaml)
55+
PACKAGE_REF="${{ env.XPKG_REGISTRY }}/${{ env.UP_ORG }}/${PROJECT_NAME}:${{ inputs.version }}"
56+
up alpha xpkg append --extensions-root=./extensions ${PACKAGE_REF}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Composition Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request: {}
8+
9+
jobs:
10+
composition-tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
id: checkout
15+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
16+
17+
- name: Install up
18+
uses: upbound/action-up@53fe6395637d884c80d2bbc8c2d75d0ece776ced # v1
19+
with:
20+
skip-login: true
21+
22+
- name: Build project
23+
run: up project build
24+
25+
- name: Run composition tests
26+
run: up test run tests/*

.github/workflows/e2e.yaml

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,51 @@
11
name: End to End Testing
22

33
on:
4-
issue_comment:
5-
types: [created]
6-
pull_request:
7-
types: [labeled]
4+
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
5+
# pull_request_target is potentially dangerous target so we keep it strict
6+
# under the label and benefit from secret propagation
7+
pull_request_target:
8+
types:
9+
- synchronize
10+
- labeled
11+
12+
env:
13+
UP_API_TOKEN: ${{ secrets.UP_E2E_API_TOKEN || secrets.UP_API_TOKEN }}
14+
UP_ORG: ${{ secrets.UP_E2E_ORG || secrets.UP_ORG }}
15+
UP_GROUP: ${{ secrets.UP_E2E_GROUP || secrets.UP_GROUP || 'default' }}
16+
UP_ROBOT_ID: ${{ secrets.UP_E2E_ROBOT_ID || secrets.UP_ROBOT_ID }}
17+
818
jobs:
919
e2e:
10-
uses: upbound/official-providers-ci/.github/workflows/pr-comment-trigger.yml@main
11-
with:
12-
package-type: configuration
13-
secrets:
14-
UPTEST_CLOUD_CREDENTIALS: ${{ secrets.UPTEST_CLOUD_CREDENTIALS }}
15-
UPTEST_DATASOURCE: ${{ secrets.UPTEST_DATASOURCE }}
20+
if: contains(github.event.pull_request.labels.*.name, 'run-e2e-tests')
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
id: checkout
25+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
26+
with:
27+
ref: ${{ github.event.pull_request.head.sha }}
28+
29+
- name: Install and login with up
30+
if: env.UP_API_TOKEN != '' && env.UP_ORG != ''
31+
uses: upbound/action-up@53fe6395637d884c80d2bbc8c2d75d0ece776ced # v1
32+
with:
33+
api-token: ${{ env.UP_API_TOKEN }}
34+
organization: ${{ env.UP_ORG }}
35+
36+
# doesn't work with plain token when pushing otherwise
37+
- name: Login to xpkg with robot
38+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3
39+
with:
40+
registry: xpkg.upbound.io
41+
username: ${{ env.UP_ROBOT_ID }}
42+
password: ${{ env.UP_API_TOKEN }}
43+
44+
- name: Build project
45+
run: up project build
46+
47+
- name: Switch up context
48+
run: up ctx ${{ env.UP_ORG }}/upbound-gcp-us-central-1/${{ env.UP_GROUP }}
49+
50+
- name: Run e2e tests
51+
run: up test run tests/* --e2e

.github/workflows/tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
19+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2020

2121
- name: Create Tag
2222
uses: negz/create-tag@39bae1e0932567a58c20dea5a1a0d18358503320 # v1

.github/workflows/yamllint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
name: runner / yamllint
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
8+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
99
- name: yamllint
1010
uses: reviewdog/action-yamllint@f01d8a48fd8d89f89895499fca2cff09f9e9e8c0 # v1.21.0
1111
with:

.gitignore

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/.cache
2-
/.work
3-
/_output
4-
/results
5-
/.idea
6-
7-
*.xpkg
8-
kubeconfig
1+
_output
2+
.venv
3+
.up

.yamllint

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ extends: default
33
rules:
44
line-length: disable
55
document-start: disable
6+
indentation:
7+
indent-sequences: consistent

0 commit comments

Comments
 (0)