Skip to content
This repository was archived by the owner on May 8, 2022. It is now read-only.

Commit 99d66c6

Browse files
Cristiano Colangelocriscola
authored andcommitted
Release 1.0.0 (#2)
Signed-off-by: Cristiano Colangelo <cristiano.colangelo@bluewin.ch>
1 parent d4b25be commit 99d66c6

File tree

185 files changed

+32093
-2317
lines changed

Some content is hidden

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

185 files changed

+32093
-2317
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore: [ 'website/**', '.github/workflows/**', 'charts/**', '!.github/workflows/codeql-analysis.yaml', 'README.md']
7+
pull_request:
8+
branches: [ main ]
9+
paths-ignore: [ 'website/**', '.github/workflows/**', 'charts/**', '!.github/workflows/codeql-analysis.yaml', 'README.md' ]
10+
11+
jobs:
12+
codeql_analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ 'go' ]
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v2
28+
29+
# Initializes the CodeQL tools for scanning.
30+
- name: Initialize CodeQL
31+
uses: github/codeql-action/init@v1
32+
with:
33+
languages: ${{ matrix.language }}
34+
# If you wish to specify custom queries, you can do so here or in a config file.
35+
# By default, queries listed here will override any specified in a config file.
36+
# Prefix the list here with "+" to use these queries and those in the config file.
37+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
38+
39+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
40+
# If this step fails, then you should remove it and run the build manually (see below)
41+
- name: Autobuild
42+
uses: github/codeql-action/autobuild@v1
43+
44+
# ℹ️ Command-line programs to run using the OS shell.
45+
# 📚 https://git.io/JvXDl
46+
47+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
48+
# and modify them (or add more) to build your code if your project
49+
# uses a compiled language
50+
51+
#- run: |
52+
# make bootstrap
53+
# make release
54+
55+
- name: Perform CodeQL Analysis
56+
uses: github/codeql-action/analyze@v1

.github/workflows/docker.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "Docker image"
2+
on:
3+
push:
4+
branches: [ main ]
5+
paths-ignore: [ 'website/**', '.github/workflows/**', 'charts/**', '!.github/workflows/docker.yaml', 'README.md' ]
6+
release:
7+
types: [ published ]
8+
9+
jobs:
10+
push_to_registry:
11+
name: Push Docker image to Docker Hub
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out the repo
15+
uses: actions/checkout@v2
16+
- name: Log in to Docker Hub
17+
uses: docker/login-action@v1
18+
with:
19+
username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
- name: Extract metadata (tags, labels) for Docker
22+
id: meta
23+
uses: docker/metadata-action@v3
24+
with:
25+
images: bedag/kubernetes-dbaas
26+
flavor: latest=false
27+
tags: |
28+
latest
29+
type=semver,pattern={{major}}
30+
type=semver,pattern={{version}}
31+
type=semver,pattern={{major}}.{{minor}}
32+
- name: Build and push Docker image
33+
uses: docker/build-push-action@v2
34+
with:
35+
context: .
36+
push: true
37+
tags: |
38+
${{ steps.meta.outputs.tags }}
39+
labels: ${{ steps.meta.outputs.labels }}
40+
41+
security-scan:
42+
name: "Trivy vulnerability scanner"
43+
needs: push_to_registry
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v2
48+
- name: Run Trivy vulnerability scanner
49+
uses: aquasecurity/trivy-action@master
50+
with:
51+
image-ref: 'docker.io/bedag/kubernetes-dbaas:latest'
52+
format: 'template'
53+
template: '@/contrib/sarif.tpl'
54+
output: 'trivy-results.sarif'
55+
severity: 'CRITICAL,HIGH'
56+
- name: Upload Trivy scan results to GitHub Security tab
57+
uses: github/codeql-action/upload-sarif@v1
58+
with:
59+
sarif_file: 'trivy-results.sarif'

.github/workflows/docs.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Website build & deploy
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths: [ 'website/**', '.github/workflows/docs.yaml' ]
7+
push:
8+
branches: [main]
9+
paths: [ 'website/**', '.github/workflows/docs.yaml' ]
10+
11+
jobs:
12+
checks:
13+
name: Pull request checks
14+
if: github.event_name == 'pull_request'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-node@v1
19+
with:
20+
node-version: '12.x'
21+
- name: Test Build
22+
run: |
23+
if [ -e yarn.lock ]; then
24+
yarn install --frozen-lockfile
25+
elif [ -e package-lock.json ]; then
26+
npm ci
27+
else
28+
npm i
29+
fi
30+
npm run build
31+
gh-release:
32+
name: GitHub pages release
33+
if: github.event_name != 'pull_request'
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v2
37+
- uses: actions/setup-node@v1
38+
with:
39+
node-version: '12.x'
40+
- uses: webfactory/ssh-agent@v0.5.3
41+
with:
42+
ssh-private-key: ${{ secrets.BOT_SSH_PRIVATE_KEY }}
43+
- name: Import GPG key
44+
id: import_gpg
45+
uses: crazy-max/ghaction-import-gpg@v3
46+
with:
47+
gpg-private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
48+
passphrase: ${{ secrets.BOT_GPG_PRIVATE_KEY_PASSPHRASE }}
49+
git-user-signingkey: true
50+
git-commit-gpgsign: true
51+
- name: Retrieve short commit SHA
52+
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
53+
- name: Release to GitHub Pages
54+
env:
55+
USE_SSH: true
56+
GIT_USER: kubernetesdbaasbot
57+
run: |
58+
git config --global user.email "kubernetesdbaasbot@gmail.com"
59+
git config --global user.name "kubernetesdbaasbot"
60+
mkdir ../temp
61+
cd website/
62+
npm ci
63+
npm run build
64+
mv build/* ../../temp
65+
cd ..
66+
git fetch
67+
git switch gh-pages
68+
rm -rf *
69+
mv ../temp/* .
70+
if [[ $(git diff) ]]; then # avoid error exit code if repo is up-to-date
71+
git add .
72+
git commit -m "Deploy website - based on ${SHORT_SHA}"
73+
git push
74+
fi

.github/workflows/go.yaml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: "Test Suite"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore: [ 'website/**', 'charts/**', '.github/workflows/**', '!.github/workflows/go.yaml', 'README.md' ]
7+
pull_request:
8+
branches: [ main ]
9+
paths-ignore: [ 'website/**', 'charts/**', '.github/workflows/**', '!.github/workflows/go.yaml', 'README.md' ]
10+
11+
jobs:
12+
run_test_suite:
13+
name: "Build & Test"
14+
runs-on: ubuntu-latest
15+
16+
env:
17+
POSTGRES_HOST: localhost
18+
POSTGRES_PASSWORD: stronG!Password
19+
POSTGRES_USER: postgres
20+
POSTGRES_DB: postgres
21+
POSTGRES_PORT: 5432
22+
SQLSERVER_HOST: localhost
23+
SQLSERVER_PASSWORD: stronG!Password
24+
SQLSERVER_USER: sa
25+
SQLSERVER_DB: master
26+
SQLSERVER_PORT: 1433
27+
MARIADB_HOST: 127.0.0.1
28+
MARIADB_PASSWORD: stronG!Password
29+
MARIADB_USER: root
30+
MARIADB_DB: mysql
31+
MARIADB_PORT: 3306
32+
33+
services:
34+
postgres:
35+
image: postgres
36+
env:
37+
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
38+
options: >-
39+
--health-cmd pg_isready
40+
--health-interval 10s
41+
--health-timeout 5s
42+
--health-retries 5
43+
ports:
44+
- 5432:5432
45+
sqlserver:
46+
image: mcr.microsoft.com/mssql/server:2017-latest-ubuntu
47+
env:
48+
ACCEPT_EULA: Y
49+
SA_PASSWORD: ${{ env.SQLSERVER_PASSWORD }}
50+
DB_USER: ${{ env.SQLSERVER_USER }}
51+
ports:
52+
- 1433:1433
53+
options: >-
54+
--health-cmd "/opt/mssql-tools/bin/sqlcmd -U $DB_USER -P $SA_PASSWORD -Q 'select 1' -b -o /dev/null"
55+
--health-interval 60s
56+
--health-timeout 30s
57+
--health-start-period 20s
58+
--health-retries 3
59+
mariadb:
60+
image: mariadb:10.4
61+
env:
62+
MARIADB_ROOT_PASSWORD: ${{ env.MARIADB_PASSWORD }}
63+
options: >-
64+
--health-cmd "mysqladmin ping"
65+
--health-interval 10s
66+
--health-timeout 5s
67+
--health-retries 10
68+
--health-start-period 20s
69+
ports:
70+
- 3306:3306
71+
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v2
75+
- name: Set up Go
76+
uses: actions/setup-go@v2
77+
with:
78+
go-version: 1.16
79+
- name: Mod
80+
run: go mod tidy
81+
- name: Install Ginkgo executable
82+
run: go install github.com/onsi/ginkgo/ginkgo@v1.16.4
83+
- name: Install Envtest binaries
84+
run: |
85+
curl -sSLo envtest-bins.tar.gz "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-1.19.2-$(go env GOOS)-$(go env GOARCH).tar.gz"
86+
mkdir -p /opt/kubebuilder/testbin
87+
tar -C /opt/kubebuilder/testbin --strip-components=2 -zvxf envtest-bins.tar.gz
88+
- name: Prepare Postgres instance for testing
89+
env:
90+
# Postgres reads the password using a PGPASSWORD env variable
91+
PGPASSWORD: ${{ env.POSTGRES_PASSWORD }}
92+
run: |
93+
for f in ${{ github.workspace }}/testdata/procedures/postgresql/*.sql
94+
do
95+
echo "loading $f into postgresql"
96+
psql -h ${{ env.POSTGRES_HOST }} -p ${{ env.POSTGRES_PORT }} -d ${{ env.POSTGRES_DB }} -U ${{ env.POSTGRES_USER }} < "$f"
97+
done
98+
- name: Prepare SQLServer instance for testing
99+
run: |
100+
for f in ${{ github.workspace }}/testdata/procedures/sqlserver/*.sql
101+
do
102+
echo "loading $f into sqlserver"
103+
/opt/mssql-tools/bin/sqlcmd -S 'tcp:${{ env.SQLSERVER_HOST }},${{ env.SQLSERVER_PORT }}' -U ${{ env.SQLSERVER_USER }} -P ${{ env.SQLSERVER_PASSWORD }} -d ${{ env.SQLSERVER_DB }} -i "$f"
104+
done
105+
- name: Prepare MariaDB instance for testing
106+
run: |
107+
for f in ${{ github.workspace }}/testdata/procedures/mariadb/*.sql
108+
do
109+
echo "loading $f into mariadb"
110+
mysql -h ${{ env.MARIADB_HOST }} -P ${{ env.MARIADB_PORT }} -u ${{ env.MARIADB_USER }} --password=${{ env.MARIADB_PASSWORD }} -D ${{ env.MARIADB_DB }} < "$f"
111+
done
112+
- name: Test
113+
env:
114+
KUBEBUILDER_ASSETS: /opt/kubebuilder/testbin
115+
TEST_CONFIG_PATH: ${{ github.workspace }}/testdata/config_testing_ci.yaml
116+
POSTGRES_DSN: postgres://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.POSTGRES_HOST }}:${{ env.POSTGRES_PORT }}/${{ env.POSTGRES_DB }}
117+
SQLSERVER_DSN: sqlserver://${{ env.SQLSERVER_USER }}:${{ env.SQLSERVER_PASSWORD }}@${{ env.SQLSERVER_HOST }}:${{ env.SQLSERVER_PORT }}/${{ env.SQLSERVER_DB }}
118+
MARIADB_DSN: mariadb://${{ env.MARIADB_USER }}:${{ env.MARIADB_PASSWORD }}@${{ env.MARIADB_HOST }}:${{ env.MARIADB_PORT }}/${{ env.MARIADB_DB }}
119+
run: ginkgo -r -race -trace -cover -coverprofile=coverage.out -outputdir=testdata/coverage
120+
- name: Generate coverage report
121+
run: go tool cover -html=testdata/coverage/coverage.out -o testdata/coverage/coverage_report.html
122+
- name: Import GPG key
123+
id: import_gpg
124+
uses: crazy-max/ghaction-import-gpg@v3
125+
with:
126+
gpg-private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
127+
passphrase: ${{ secrets.BOT_GPG_PRIVATE_KEY_PASSPHRASE }}
128+
git-user-signingkey: true
129+
git-commit-gpgsign: true
130+
- name: Pull latest changes
131+
run: git pull
132+
- name: Push coverage report
133+
uses: stefanzweifel/git-auto-commit-action@v4
134+
with:
135+
commit_user_name: kubernetesdbaasbot
136+
commit_user_email: kubernetesdbaasbot@gmail.com
137+
commit_message: Update code coverage
138+
file_pattern: testdata/coverage/coverage_report.html
139+

.github/workflows/helm.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Helm Chart linter
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths: [ 'charts/kubernetes-dbaas/**', '.github/workflows/helm.yaml' ]
7+
push:
8+
branches: [main]
9+
paths: [ 'charts/kubernetes-dbaas/**', '.github/workflows/helm.yaml' ]
10+
11+
jobs:
12+
checks:
13+
name: Helm Chart linter
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Helm
22+
uses: azure/setup-helm@v1
23+
with:
24+
version: v3.4.0
25+
26+
- uses: actions/setup-python@v2
27+
with:
28+
python-version: 3.7
29+
30+
- name: Set up chart-testing
31+
uses: helm/chart-testing-action@v2.1.0
32+
33+
- name: Run chart-testing (lint)
34+
run: ct lint --all

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ testbin/*
2626

2727
# don't push your config publicly
2828
config.yaml
29-
configtest.yaml
29+
config_testing.yaml
3030

3131
# dbeaver stuff
3232
.dbeaver/
3333
.project
34+
35+
# values used for local deployment
36+
myvalues.yaml

CONTRIBUTING.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)