Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from CircleCI to Github Actions #324

Merged
merged 42 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
936e3e4
Migrate from CircleCI to Github Actions
spirosoik Dec 15, 2022
fc31df4
[fix] Remove CircleCI
spirosoik Dec 15, 2022
8b77710
[fix] exclude vendor from lint
spirosoik Dec 16, 2022
377df79
[fix] golang version to 1.19
spirosoik Dec 16, 2022
a45854b
Use custom GOPATH in github actions (#328)
fmartingr Dec 24, 2022
266727e
Merge branch 'master' into feat/CLD-4711
mattermost-build Jan 12, 2023
bb36932
[fix] kind cluster wait to be created
spirosoik Jan 13, 2023
47e049d
Merge branch 'master' into feat/CLD-4711
mattermost-build Jan 19, 2023
0555abe
[fix] go cache dependency path
spirosoik Jan 19, 2023
4b8b896
[fix] update kind verson and k8s
spirosoik Jan 27, 2023
740b0fb
Merge branch 'master' into feat/CLD-4711
mattermost-build Jan 27, 2023
490936f
fix(ci): Add patch for MySQL operator on steup_test.sh
toninis Feb 2, 2023
7dd0d34
test: Add temp SSH session for debug
toninis Feb 8, 2023
7323c97
Merge branch 'master' into feat/CLD-4711
mattermost-build Feb 8, 2023
d33e66a
fixed fatal: detected dubious ownership issue with git checkout
toninis Feb 8, 2023
ebada40
test on local runners
toninis Feb 9, 2023
9c72d3e
upgrade percona to 5.7.35
toninis Feb 9, 2023
e893fe2
test in mac since I am now desperate
toninis Feb 9, 2023
470b5a8
try ubuntu-20.04
toninis Feb 9, 2023
207773e
test kind cluster from github actions
toninis Feb 9, 2023
a6b5856
1.24 k8s version
toninis Feb 9, 2023
5314f21
upgrade mysql-operator and use helm
toninis Feb 9, 2023
9eda10b
test with Percona 8.0
toninis Feb 14, 2023
a030ca5
remove upterm
toninis Feb 14, 2023
7ef02b6
add commented out tests
toninis Feb 14, 2023
02679f7
Merge branch 'master' into feat/CLD-4711
mattermost-build Feb 15, 2023
9f60236
test CVE upload results
toninis Feb 15, 2023
f427c7c
Update .github/workflows/ci.yml
spirosoik Feb 15, 2023
a9328f9
Update .github/workflows/cd.yml
spirosoik Feb 15, 2023
21c66f6
naming convention . Trivy fix
toninis Feb 15, 2023
4c1fde9
fix docker login
toninis Feb 15, 2023
52d89d2
fix sarif output
toninis Feb 15, 2023
8c12468
continue on error for now for trivy results
toninis Feb 15, 2023
d50c28d
always upload since there is no failure for now
toninis Feb 15, 2023
b8c1879
allow specifying a mysql database version
fmartingr Feb 15, 2023
706bd12
Set mysql version only for mysql database type
fmartingr Feb 15, 2023
6efdb33
ignore trivy result
fmartingr Mar 1, 2023
fa52f48
Merge remote-tracking branch 'origin/master' into feat/CLD-4711
fmartingr Mar 2, 2023
ad1302b
checking lesser retry interval
fmartingr Mar 2, 2023
7a9ef97
even longer...?
fmartingr Mar 2, 2023
83df8c3
try running in 4core machine
fmartingr Mar 7, 2023
4fec13f
Merge remote-tracking branch 'origin/master' into feat/CLD-4711
fmartingr Mar 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
230 changes: 0 additions & 230 deletions .circleci/config.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: cd
on:
workflow_run:
workflows: ["ci"]
branches-ignore: ["*"]
types:
- completed
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6 # v3.2.0
with:
fetch-depth: 0
Comment on lines +21 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sold on this. A shallow clone should be enough for the needs of CI.


- name: cd/build-docker
run: make build-image

- name: ci/push-docker
run: |
set -eu
echo $DOCKERHUB_TOKEN | docker login --username $DOCKERHUB_USERNAME --password-stdin
spirosoik marked this conversation as resolved.
Show resolved Hide resolved
docker tag mattermost/mattermost-operator:test mattermost/mattermost-operator:$TAG
docker push mattermost/mattermost-operator:$TAG
env:
TAG: ${{ github.ref_name }}
132 changes: 132 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: ci
on:
push:
branches:
- master
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: ci/checkout-repo
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
with:
fetch-depth: 0
Comment on lines +19 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sold on this. A shallow clone should be enough for the needs of CI.


- name: ci/setup-go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: "1.19"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the gomod file in root dir, to dynamically setup the GoLang version during CI runtime /~https://github.com/actions/setup-go#getting-go-version-from-the-gomod-file

cache: true

- name: ci/check-style
run: make check-style

- name: ci/check-modules
run: make check-modules

test:
runs-on: ubuntu-22.04
steps:
- name: ci/checkout-repo
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
with:
fetch-depth: 0
Comment on lines +39 to +40
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sold on this. A shallow clone should be enough for the needs of CI.

path: src/github.com/mattermost/mattermost-operator

- name: ci/setup-go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: "1.19"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the gomod file in root dir, to dynamically setup the GoLang version during CI runtime /~https://github.com/actions/setup-go#getting-go-version-from-the-gomod-file

cache: true
cache-dependency-path: src/github.com/mattermost/mattermost-operator/go.sum

- name: ci/generate-operator-manifests
run: |
cd ${GITHUB_WORKSPACE}/src/github.com/mattermost/mattermost-operator

make clean
make operator-sdk

mkdir -p /tmp/apis/mattermost/v1alpha1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mkdirs could be concantanated in a single line with :

mkdir -p /tmp/apis/mattermost/v1alpha1 /tmp/apis/mattermost/v1beta1 /tmp/config/crd/bases

Less syscalls !

cp -R apis/mattermost/v1alpha1/* /tmp/apis/mattermost/v1alpha1
mkdir -p /tmp/apis/mattermost/v1beta1
cp -R apis/mattermost/v1beta1/* /tmp/apis/mattermost/v1beta1
mkdir -p /tmp/config/crd/bases
cp -R config/crd/bases/* /tmp/config/crd/bases

GOPATH=${GITHUB_WORKSPACE} make generate manifests
diff /tmp/apis/mattermost/v1alpha1 apis/mattermost/v1alpha1
diff /tmp/apis/mattermost/v1beta1 apis/mattermost/v1beta1
diff /tmp/config/crd/bases config/crd/bases

- name: ci/test
run: |
cd ${GITHUB_WORKSPACE}/src/github.com/mattermost/mattermost-operator
make unittest goverall

- name: ci/test-e2e
run: |
cd ${GITHUB_WORKSPACE}/src/github.com/mattermost/mattermost-operator
./test/e2e.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: I'd prefer to have this as part of a makefile target, to decouple from hard-calling the script.
like: make e2e-tests

env:
K8S_VERSION: v1.22.9
IMAGE_NAME: mattermost/mattermost-operator
IMAGE_TAG: test
KIND_VERSION: v0.17.0
SDK_VERSION: v1.0.1

build:
if: ${{ github.event_name == 'pull_request' || github.ref_name == 'master' }}
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: ci/checkout-repo
uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6 # v3.2.0
with:
fetch-depth: 0
Comment on lines +92 to +93
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sold on this. A shallow clone should be enough for the needs of CI.


- name: ci/set-short-SHA
run: echo "SHORT_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV

- name: ci/build-docker
run: make build-image

- name: ci/scan-docker-security
uses: aquasecurity/trivy-action@8bd2f9fbda2109502356ff8a6a89da55b1ead252 # v0.9.1
continue-on-error: true
with:
image-ref: "mattermost/mattermost-operator:test"
format: "sarif"
limit-severities-for-sarif: true # /~https://github.com/aquasecurity/trivy-action/blob/0.9.1/entrypoint.sh#L172
output: "trivy-results.sarif"
exit-code: "1"
ignore-unfixed: true
vuln-type: "os,library"
severity: "CRITICAL,HIGH"

- name: ci/create-trivy-results-report
# if: failure()
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
with:
sarif_file: "trivy-results.sarif"

- name: ci/docker-login
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: ci/docker-push
env:
TAG: ${{ env.SHORT_SHA }}
run: |
set -eu
docker tag mattermost/mattermost-operator:test mattermost/mattermost-operator:$TAG
docker push mattermost/mattermost-operator:$TAG
Loading