Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
File renamed without changes.
195 changes: 99 additions & 96 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ on:
- main
- dev
- MikhailDeriabin/feature/670-migrate-ci-gh-actions
# pull_request:
# branches:
# - '**'
- MikhailDeriabin/feature/670-migrate-ci-gh-actions-new
pull_request:
branches:
- '**'

defaults:
run:
Expand All @@ -17,7 +18,8 @@ defaults:
jobs:
test:
name: Run tests
runs-on: [ self-hosted, gh-runner-common ]
# runs-on: [self-hosted, gh-runner-common]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
Expand Down Expand Up @@ -62,96 +64,97 @@ jobs:
files: ./frontend-next-migration/coverage/coverage-final.json
fail_ci_if_error: true

# build-and-push:
# name: Build and Push Docker Image
## needs: test
# if: github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'MikhailDeriabin/feature/670-migrate-ci-gh-actions'
# runs-on: [self-hosted, gh-runner-common]
# steps:
# - name: Checkout code
# uses: actions/checkout@v7
#
# - name: Log in to Docker Hub
# uses: docker/login-action@v4
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# - name: Write build env file
# env:
# ENV_LOCAL_BUILD: ${{ secrets.SITE_ENV_LOCAL_BUILD }}
# run: printf '%s' "$ENV_LOCAL_BUILD" > .env.local
#
# - name: Build and push image
# uses: docker/build-push-action@v7
# env:
# DOCKER_BUILD_RECORD_UPLOAD: false
# with:
# context: frontend-next-migration
# push: true
# load: true
# tags: |
# ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:dev-27
# ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:dev-latest
## ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ github.ref_name }}-${{ github.run_number }}
## ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ github.ref_name }}-latest
#
# - name: Clean up build env file
# if: always()
# run: rm -f .env.local
#
# - name: Scan image for vulnerabilities
# uses: aquasecurity/trivy-action@v0.36.0
# with:
# image-ref: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:dev-27
## image-ref: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ github.ref_name }}-${{ github.run_number }}
# format: json
# ignore-unfixed: true
# exit-code: '0'
# output: frontend-next-migration/trivy-results.json
#
# - name: Upload vulnerabilities to summary tab
# if: always()
# run: |
# {
# echo "## Vulnerability scan results"
# echo ""
# echo "| Target | Package | CVE | Severity | Installed | Fixed |"
# echo "|---|---|---|---|---|---|"
# jq -r '
# .Results[]?
# | select(.Vulnerabilities != null)
# | .Target as $t
# | .Vulnerabilities[]
# | "| \($t) | \(.PkgName) | \(.VulnerabilityID) | \(.Severity) | \(.InstalledVersion) | \(.FixedVersion // "-") |"
# ' trivy-results.json
# } >> "$GITHUB_STEP_SUMMARY"
#
# - name: Convert scan results to SARIF format
# if: always()
# run: trivy convert --format sarif --output trivy-results.sarif trivy-results.json
#
# - name: Upload vulnerabilities to Security tab
# uses: github/codeql-action/upload-sarif@v4
# with:
# sarif_file: frontend-next-migration/trivy-results.sarif

# notify:
# name: Notify server about new image build
# needs: build-and-push
# if: github.ref_name == 'main' || github.ref_name == 'dev'
# runs-on: [self-hosted, gh-runner-common]
# steps:
# - name: Notify server
# env:
# WEBHOOK_SECRET: ${{ secrets.SERVER_WEBHOOK_NOTIFY_SECRET }}
# WEBHOOK_URL: ${{ secrets.SERVER_WEBHOOK_NOTIFY_URL }}
build-and-push:
name: Build and Push Docker Image
needs: test
if: github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'MikhailDeriabin/feature/670-migrate-ci-gh-actions'
runs-on: [self-hosted, gh-runner-common]
steps:
- name: Checkout code
uses: actions/checkout@v7

- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Write build env file
env:
ENV_LOCAL_BUILD: ${{ secrets.SITE_ENV_LOCAL_BUILD }}
run: printf '%s' "$ENV_LOCAL_BUILD" > .env.local

- name: Build and push image
uses: docker/build-push-action@v7
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: frontend-next-migration
push: true
load: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:dev-${{ github.run_number }}
${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:dev-latest
# ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ github.ref_name }}-${{ github.run_number }}
# ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ github.ref_name }}-latest

- name: Clean up build env file
if: always()
run: rm -f .env.local

- name: Scan image for vulnerabilities
uses: aquasecurity/trivy-action@v0.36.0
with:
image-ref: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:dev-${{ github.run_number }}
# image-ref: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ github.ref_name }}-${{ github.run_number }}
format: json
ignore-unfixed: true
exit-code: '0'
output: frontend-next-migration/trivy-results.json

- name: Upload vulnerabilities to summary tab
if: always()
run: |
{
echo "## Vulnerability scan results"
echo ""
echo "| Target | Package | CVE | Severity | Installed | Fixed |"
echo "|---|---|---|---|---|---|"
jq -r '
.Results[]?
| select(.Vulnerabilities != null)
| .Target as $t
| .Vulnerabilities[]
| "| \($t) | \(.PkgName) | \(.VulnerabilityID) | \(.Severity) | \(.InstalledVersion) | \(.FixedVersion // "-") |"
' trivy-results.json
} >> "$GITHUB_STEP_SUMMARY"

- name: Convert scan results to SARIF format
if: always()
run: trivy convert --format sarif --output trivy-results.sarif trivy-results.json

- name: Upload vulnerabilities to Security tab
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: frontend-next-migration/trivy-results.sarif

notify:
name: Notify server about new image build
needs: build-and-push
if: github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'MikhailDeriabin/feature/670-migrate-ci-gh-actions'
runs-on: [self-hosted, gh-runner-common]
steps:
- name: Notify server
env:
WEBHOOK_SECRET: ${{ secrets.SERVER_WEBHOOK_NOTIFY_SECRET }}
WEBHOOK_URL: ${{ secrets.SERVER_WEBHOOK_NOTIFY_URL }}
PAYLOAD: '{"name": "site", "tag": "dev"}'
# PAYLOAD: '{"name": "site", "tag": "${{ github.ref_name }}"}'
# run: |
# SIGNATURE=$(echo "$PAYLOAD" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | sed 's/^.* //')
#
# curl -s -o /dev/null -X POST "$WEBHOOK_URL" \
# -H "Content-Type: application/json" \
# -H "X-Hub-Signature: sha256=$SIGNATURE" \
# -d "$PAYLOAD" \
# --insecure
run: |
SIGNATURE=$(echo "$PAYLOAD" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | sed 's/^.* //')

curl -s -o /dev/null -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
-H "X-Hub-Signature: sha256=$SIGNATURE" \
-d "$PAYLOAD" \
--insecure
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![codecov](https://yrfbcpxonsco.mikhail.com.de/github/Alt-Org/Altzone-WebPages/graph/badge.svg?token=HYZVADVM8S)](https://yrfbcpxonsco.mikhail.com.de/github/Alt-Org/Altzone-WebPages)

# Altzone-WebPages

Welcome to the **Altzone-WebPages** repository! 🎉
Expand Down
11 changes: 11 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
coverage:
status:
project:
default:
target: 1
patch:
default:
target: 1

codecov:
branch: dev
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const NewClanForm = ({ onSuccess, className = '' }: Props) => {
className={classNames(cls.Form, {}, [className])}
onSubmit={handleSubmit(onFormSubmit)}
>
<CustomForm.Header>Luo Klaani. Changed</CustomForm.Header>
<CustomForm.Header>Luo Klaani</CustomForm.Header>

<CustomForm.InputField
key={'name'}
Expand Down

This file was deleted.

This file was deleted.

Loading