Adding gitleaks
as PR Check
#269
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-pipeline | |
on: | |
pull_request: | |
branches: [master] | |
types: [opened, synchronize, reopened] | |
jobs: | |
pre-checks: | |
runs-on: ubuntu-latest | |
steps: | |
# Install golang | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: 1.14 | |
# Checkout to the latest commit | |
# On specific directory/path | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: gofmt check | |
run: make gofmt-check | |
- name: golangci-lint | |
uses: reviewdog/action-golangci-lint@v1 | |
- name: unused-package check | |
run: make unused-package-check | |
gitleaks-scan: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Run GitLeaks | |
run: | | |
wget https://github.com/gitleaks/gitleaks/releases/download/v8.18.2/gitleaks_8.18.2_linux_x64.tar.gz && \ | |
tar -zxvf gitleaks_8.18.2_linux_x64.tar.gz && \ | |
sudo mv gitleaks /usr/local/bin && gitleaks detect --source . -v | |
image-build: | |
runs-on: ubuntu-latest | |
needs: pre-checks | |
steps: | |
# Checkout to the latest commit | |
# On specific directory/path | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Build Docker Image | |
env: | |
DOCKER_REPO: litmuschaos | |
DOCKER_IMAGE: chaos-operator | |
DOCKER_TAG: ci | |
run: | | |
make build-amd64 | |
docker save -o ${{ github.workspace }}/image.tar litmuschaos/chaos-operator:ci | |
chmod +x ${{ github.workspace }}/image.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: myimage | |
path: | | |
${{ github.workspace }}/image.tar | |
tests: | |
runs-on: ubuntu-latest | |
needs: image-build | |
steps: | |
# Install golang | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: 1.14 | |
# Checkout to the latest commit | |
# On specific directory/path | |
- name: Checkout | |
uses: actions/checkout@v2 | |
#Install and configure a kind cluster | |
- name: Installing Prerequisites (K3S Cluster) | |
env: | |
KUBECONFIG: /etc/rancher/k3s/k3s.yaml | |
run: | | |
curl -sfL https://get.k3s.io | sh -s - --docker --write-kubeconfig-mode 664 | |
kubectl wait node --all --for condition=ready --timeout=90s | |
mkdir -p $HOME/.kube | |
cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config | |
kubectl get nodes | |
- name: Dependency checks | |
run: | | |
make deps | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: myimage | |
path: ${{ github.workspace }} | |
- name: Load Docker image | |
run: | | |
docker load --input ${{ github.workspace }}/image.tar | |
shell: bash | |
- name: Running Go BDD Test | |
run: | | |
make test |