Skip to content

Commit fa761d5

Browse files
committed
feat: add first code adapted from Kubesight
1 parent 967dab1 commit fa761d5

25 files changed

Lines changed: 9713 additions & 0 deletions

.dockerignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.dockerignore
2+
.git
3+
.github
4+
.gitignore
5+
.next
6+
.socialgouv
7+
__tests__
8+
docker-compose.yaml
9+
Dockerfile
10+
jest.config.js
11+
node_modules
12+
npm-debug.log
13+
README.md
14+
CHANGELOG.md
15+
packages
16+
sonar-project.properties
17+
.kontinuous
18+
.talismanrc
19+
.pnp.*
20+
.yarn/*
21+
!.yarn/patches
22+
!.yarn/plugins
23+
!.yarn/releases
24+
!.yarn/sdks
25+
!.yarn/versions

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Protect workflow files
2+
.github/workflows/*.yml @socialgouv/sre
3+
.github/CODEOWNERS @socialgouv/sre
4+
.socialgouv/ @socialgouv/sre

.github/renovate.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"local>SocialGouv/renovate-config:light"
5+
]
6+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: 📦 Build Docker Image 🥷
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
- "!master"
8+
tags:
9+
- "**"
10+
11+
concurrency:
12+
cancel-in-progress: true
13+
group: ${{ github.workflow }}-${{ github.event.ref }}
14+
15+
jobs:
16+
build-base-images:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Log in to the Container registry
26+
uses: docker/login-action@v2
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Load tag metadata variables
33+
id: tag-vars
34+
shell: bash
35+
run: |
36+
BRANCH_TAG=$(git rev-parse --abbrev-ref HEAD | sed 's/[^a-zA-Z0-9]/-/g')
37+
if [ $BRANCH_TAG = "HEAD" ]; then
38+
BRANCH_TAG=master
39+
fi
40+
echo "branch-tag=$BRANCH_TAG">>$GITHUB_OUTPUT
41+
42+
- name: Extract metadata (tags, labels) for Docker
43+
id: meta
44+
uses: docker/metadata-action@v4
45+
with:
46+
images: ghcr.io/${{ github.repository }}
47+
tags: |
48+
type=schedule
49+
type=ref,event=branch
50+
type=ref,event=pr
51+
type=semver,pattern=v{{version}}
52+
type=semver,pattern=v{{major}}.{{minor}}
53+
type=sha
54+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
55+
type=raw,value=${{ steps.tag-vars.outputs.branch-tag }},enable=${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}
56+
57+
- name: Build and push Docker image
58+
uses: docker/build-push-action@v4
59+
with:
60+
context: "."
61+
file: Dockerfile
62+
push: true
63+
tags: ${{ steps.meta.outputs.tags }}
64+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "master" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "master" ]
20+
schedule:
21+
- cron: '18 19 * * 0'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
# Runner size impacts CodeQL analysis time. To learn more, please see:
27+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
28+
# - https://gh.io/supported-runners-and-hardware-resources
29+
# - https://gh.io/using-larger-runners
30+
# Consider using larger runners for possible analysis time improvements.
31+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
32+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
33+
permissions:
34+
actions: read
35+
contents: read
36+
security-events: write
37+
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
language: [ 'javascript-typescript' ]
42+
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
43+
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
44+
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
45+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
46+
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v4
50+
51+
# Initializes the CodeQL tools for scanning.
52+
- name: Initialize CodeQL
53+
uses: github/codeql-action/init@v2
54+
with:
55+
languages: ${{ matrix.language }}
56+
# If you wish to specify custom queries, you can do so here or in a config file.
57+
# By default, queries listed here will override any specified in a config file.
58+
# Prefix the list here with "+" to use these queries and those in the config file.
59+
60+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
61+
# queries: security-extended,security-and-quality
62+
63+
64+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
65+
# If this step fails, then you should remove it and run the build manually (see below)
66+
- name: Autobuild
67+
uses: github/codeql-action/autobuild@v2
68+
69+
# ℹ️ Command-line programs to run using the OS shell.
70+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
71+
72+
# If the Autobuild fails above, remove it and uncomment the following three lines.
73+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
74+
75+
# - run: |
76+
# echo "Run, Build Application using script"
77+
# ./location_of_script_within_repo/buildscript.sh
78+
79+
- name: Perform CodeQL Analysis
80+
uses: github/codeql-action/analyze@v2
81+
with:
82+
category: "/language:${{matrix.language}}"
83+

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 🎉 Release Commit
2+
3+
on:
4+
workflow_dispatch:
5+
# pull_request:
6+
# types: [closed]
7+
8+
concurrency:
9+
cancel-in-progress: true
10+
group: ${{ github.workflow }}-${{ github.ref_name }}
11+
12+
jobs:
13+
yarn-release:
14+
# if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
15+
runs-on: ubuntu-latest
16+
name: Create release using commit-and-tag-version
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
22+
23+
- name: Install dependencies
24+
run: yarn --immutable
25+
26+
- name: Import GPG key
27+
uses: crazy-max/ghaction-import-gpg@v6
28+
with:
29+
gpg_private_key: ${{ secrets.SOCIALGROOVYBOT_GPG_PRIVATE_KEY }}
30+
passphrase: ${{ secrets.SOCIALGROOVYBOT_GPG_PASSPHRASE }}
31+
git_user_signingkey: true
32+
git_commit_gpgsign: true
33+
git_push_gpgsign: false
34+
git_tag_gpgsign: true
35+
36+
- name: Run release
37+
env:
38+
GIT_AUTHOR_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
39+
GIT_AUTHOR_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
40+
GIT_COMMITTER_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
41+
GIT_COMMITTER_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
42+
run: yarn release
43+
44+
- name: Push release
45+
shell: bash
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: |
49+
git remote set-url --push origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
50+
git push -f --follow-tags origin master

.github/workflows/tests.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
tags-ignore:
8+
- v*
9+
10+
concurrency:
11+
cancel-in-progress: true
12+
group: tests-${{ github.ref }}
13+
14+
jobs:
15+
##############################################################################
16+
## TEST APPLICATION
17+
##############################################################################
18+
test:
19+
name: Test application
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Node setup
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: "20"
31+
cache: "yarn"
32+
33+
- name: Install dependencies
34+
run: yarn --immutable
35+
36+
- name: Lint
37+
run: yarn lint
38+
39+
- name: Build
40+
run: yarn build
41+
42+
# - name: Run tests
43+
# run: yarn test --coverage
44+
45+
# - name: SonarCloud Scan
46+
# uses: SonarSource/sonarcloud-github-action@master
47+
# env:
48+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
49+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
.pnp.*
10+
.yarn/*
11+
!.yarn/patches
12+
!.yarn/plugins
13+
!.yarn/releases
14+
!.yarn/sdks
15+
!.yarn/versions
16+
17+
# testing
18+
/coverage
19+
20+
# next.js
21+
/.next/
22+
/out/
23+
24+
# production
25+
/build
26+
27+
# misc
28+
.DS_Store
29+
*.pem
30+
31+
# debug
32+
npm-debug.log*
33+
yarn-debug.log*
34+
yarn-error.log*
35+
36+
# local env files
37+
.env*.local
38+
39+
# vercel
40+
.vercel
41+
42+
# typescript
43+
*.tsbuildinfo
44+
next-env.d.ts
45+
46+
# Sentry Config File
47+
.sentryclirc
48+
49+
dist/

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
exec < /dev/tty; yarn node-talisman --githook pre-commit -i

.prettierrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": false,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"printWidth": 80,
6+
"singleQuote": false,
7+
"trailingComma": "es5"
8+
}

0 commit comments

Comments
 (0)