Skip to content

Commit 08d525b

Browse files
authored
Merge pull request #27 from devsecblueprint/25-move-from-aws-scheduled-lambda-to-always-on-kubernetes-bot
Migrating to K8s On-Prem
2 parents f140614 + 0cbce3e commit 08d525b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1210
-1972
lines changed

.github/workflows/docker-publish.yml

Lines changed: 0 additions & 190 deletions
This file was deleted.

.github/workflows/lint-format.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Linting and Formating checks
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
# Run Pylint and Black formatter
7+
lint_format:
8+
name: Pylint and Black
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: ["3.12.6"]
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: "Setup Python ${{ matrix.python-version}}"
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: "${{ matrix.python-version}}"
20+
21+
- name: Install dependencies
22+
run: |
23+
pip install -r requirements.txt
24+
python -m pip install --upgrade pip
25+
26+
- name: Run pylint
27+
run: pylint .
28+
29+
- name: Run black
30+
run: black --check .

.github/workflows/main.yml

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,18 @@
1-
name: "Default Workflow (main)"
2-
1+
name: Main Workflow
32
on:
43
push:
54
branches:
65
- main
76
workflow_dispatch:
87

8+
permissions:
9+
contents: read
10+
security-events: write
11+
actions: read
12+
id-token: write
13+
packages: write
14+
915
jobs:
10-
syntax-check:
11-
uses: ./.github/workflows/syntax-check.yml
12-
create-ecr-repositories:
13-
needs:
14-
- syntax-check
15-
uses: ./.github/workflows/terraform-apply.yml
16-
permissions:
17-
contents: read
18-
secrets: inherit
19-
with:
20-
tf_workspace: "discord-bot-repositories"
21-
config_directory: "./terraform/repositories"
22-
publish-images:
23-
uses: ./.github/workflows/docker-publish.yml
24-
secrets: inherit
25-
needs: create-ecr-repositories
26-
create-core-infrastructure:
27-
needs:
28-
- publish-images
29-
uses: ./.github/workflows/terraform-apply.yml
30-
permissions:
31-
contents: read
32-
secrets: inherit
33-
with:
34-
tf_workspace: "discord-bot"
35-
config_directory: "./terraform/core"
16+
push-docker-image:
17+
uses: ./.github/workflows/push-docker-image.yml
18+
secrets: inherit

.github/workflows/pr.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request_target:
55

66
jobs:
7-
syntax_check:
8-
if: github.repository_owner == 'devsecblueprint'
9-
uses: ./.github/workflows/syntax-check.yml
7+
lint-format:
8+
uses: ./.github/workflows/lint-format.yml
9+
unit-sec-scan:
10+
uses: ./.github/workflows/unit-sec-test.yml
11+
needs: lint-format
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Push Docker Image - GitHub Container Registry (GHCR)
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: "the-herald"
9+
10+
jobs:
11+
Push_Image:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
# Set up Docker Buildx
18+
- name: Set up Docker Buildx
19+
id: buildx
20+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
21+
22+
# Extract metadata (tags, labels) for Docker
23+
- name: Extract metadata for Docker
24+
id: meta
25+
uses: docker/metadata-action@v3
26+
with:
27+
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
28+
29+
# Login against a Docker registry
30+
- name: Log into registry ${{ env.REGISTRY }}
31+
if: github.event_name != 'pull_request'
32+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
# Build and tag Docker Image
39+
- name: Build & Push Multi-Arch Docker Image
40+
run: |
41+
docker buildx build \
42+
--platform linux/amd64,linux/arm64 \
43+
-t ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest \
44+
--push \
45+
.

.github/workflows/syntax-check.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)