Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
EVEREST-107 dev CI (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
oksana-grishchenko committed Dec 28, 2023
1 parent 17d0919 commit f91a4af
Show file tree
Hide file tree
Showing 8 changed files with 549 additions and 26 deletions.
18 changes: 3 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Build and push dev-latest image

on:
workflow_dispatch:
inputs:
tag:
description: An image tag
required: false
push:
branches:
- main
Expand Down Expand Up @@ -68,20 +64,12 @@ jobs:
cd ${GITHUB_WORKSPACE}/backend
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build
- name: Set tag from inputs
run: echo "IMAGE_TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
if: ${{ github.event.inputs.tag != '' }}

- name: Set tag from inputs
run: echo "IMAGE_TAG=dev-latest" >> $GITHUB_ENV
if: ${{ github.event.inputs.tag == '' }}

- name: Setup docker build metadata
uses: docker/metadata-action@v5
id: meta
with:
images: perconalab/everest
tags: ${{ env.IMAGE_TAG }}
tags: 0.0.0


- name: Login to GitHub Container Registry
Expand All @@ -90,7 +78,7 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push everest dev-latest image
- name: Build and Push everest dev image
uses: docker/build-push-action@v5
with:
context: backend
Expand All @@ -103,7 +91,7 @@ jobs:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.16.0
with:
image-ref: 'docker.io/perconalab/everest:dev-latest'
image-ref: 'docker.io/perconalab/everest:0.0.0'
format: 'table'
exit-code: '1'
severity: 'CRITICAL,HIGH'
25 changes: 23 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,27 @@ jobs:
- name: Install tools
run: make init

- name: Check the latest operator version is used
run: |
go get github.com/percona/everest-operator@main
echo "Checking there is no source code changes"
go mod tidy
git diff --exit-code
- name: Check the Makefile references dev version
run: |
if ! grep -q "RELEASE_VERSION ?= v0.0.0" Makefile; then
echo "default RELEASE_VERSION in Makefile should be 0.0.0"
exit 1
fi
- name: Check the quickstart script references dev version
run: |
if ! grep -q "perconalab/everest:0.0.0" deploy/quickstart-k8s.yaml; then
echo "deploy/quickstart-k8s.yaml should reference 0.0.0 version"
exit 1
fi
- name: Run checks/linters
run: |
# use GITHUB_TOKEN because only it has access to GitHub Checks API
Expand Down Expand Up @@ -267,9 +288,9 @@ jobs:
with:
images: localhost:5000/perconalab/everest
tags:
dev-latest
0.0.0

- name: Build and Push everest dev-latest image
- name: Build and Push everest dev image
uses: docker/build-push-action@v5
with:
context: .
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FILES = $(shell find . -type f -name '*.go')

RELEASE_VERSION ?= $(shell git describe --always --tags | cut -b2-)
RELEASE_VERSION ?= v0.0.0-$(shell git rev-parse --short HEAD)
RELEASE_FULLCOMMIT ?= $(shell git rev-parse HEAD)

FLAGS = -X 'github.com/percona/percona-everest-backend/pkg/version.ProjectName=Everest Backend' \
Expand Down
4 changes: 2 additions & 2 deletions api-tests/tests/version.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ test('version endpoint', async ({ request, cli }) => {

const versionJSON = await version.json()

const gitVersion = await cli.exec('git describe --always --tags | cut -b2-')
const gitVersion = await cli.exec('git rev-parse --short HEAD')

await gitVersion.assertSuccess()

expect(versionJSON.projectName).toEqual('Everest Backend')
expect(versionJSON.version).toEqual(gitVersion.getStdOutLines()[0])
expect(versionJSON.version).toEqual('v0.0.0-' + gitVersion.getStdOutLines()[0])
})
2 changes: 1 addition & 1 deletion deploy/quickstart-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ spec:
topologyKey: "kubernetes.io/hostname"
containers:
- name: everest
image: perconalab/everest:dev-latest
image: perconalab/everest:0.0.0
ports:
- containerPort: 8080
readinessProbe:
Expand Down
2 changes: 1 addition & 1 deletion dev/patch-deployment-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ spec:
podAntiAffinity: {}
containers:
- name: everest
image: localhost:5000/perconalab/everest:dev-latest
image: localhost:5000/perconalab/everest:0.0.0
31 changes: 29 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/labstack/echo/v4 v4.11.3
github.com/oapi-codegen/echo-middleware v1.0.1
github.com/oapi-codegen/runtime v1.1.0
github.com/percona/everest-operator v0.6.0-dev1.0.20231215203757-caec30c771c5
github.com/percona/everest-operator v0.6.0-dev1.0.20231228161448-9554994bae64
github.com/stretchr/testify v1.8.4
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.16.0
Expand All @@ -28,48 +28,74 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/cert-manager/cert-manager v1.12.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/flosch/pongo2/v6 v6.0.0 // indirect
github.com/go-errors/errors v1.5.0 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/go-test/deep v1.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/jessevdk/go-flags v1.5.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/minio/minio-go v6.0.14+incompatible // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/mongodb/mongo-tools v0.0.0-20230720205640-fb74684da15f // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/montanaflynn/stats v0.6.6 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/percona/percona-backup-mongodb v1.8.1-0.20230920143330-3b1c2e263901 // indirect
github.com/percona/percona-postgresql-operator v0.0.0-20230629061704-21f8d7d89b98 // indirect
github.com/percona/percona-server-mongodb-operator v1.15.0 // indirect
github.com/percona/percona-xtradb-cluster-operator v1.13.0 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
go.mongodb.org/mongo-driver v1.12.1 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sync v0.4.0 // indirect
Expand All @@ -88,6 +114,7 @@ require (
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/mcs-api v0.1.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit f91a4af

Please sign in to comment.