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

Increment project packages, update GitHub workflow versions, implement current DevOps config #109

Merged
merged 20 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4a575a5
Update base image minor version.
ropable Oct 18, 2023
49e0d73
Tweak Kustomize resources.
ropable Nov 28, 2023
b1360ae
Added dependabot.yml
ropable Nov 28, 2023
c6b7b2e
Bump actions/checkout from 3 to 4
dependabot[bot] Nov 28, 2023
c7d2a6c
Bump docker/login-action from 2 to 3
dependabot[bot] Nov 28, 2023
be2b39d
Bump docker/metadata-action from 4 to 5
dependabot[bot] Nov 28, 2023
1635ff1
Bump docker/build-push-action from 3 to 5
dependabot[bot] Nov 28, 2023
4f8c931
Added pre-commit config.
ropable Nov 28, 2023
6d53471
Updated README
ropable Nov 28, 2023
602da09
Merge pull request #5 from ropable/dependabot/github_actions/actions/…
ropable Nov 28, 2023
89794a8
Merge branch 'master' of github.com:ropable/ibms
ropable Nov 28, 2023
0b3b1e4
Merge pull request #6 from ropable/dependabot/github_actions/docker/l…
ropable Nov 28, 2023
83e09ee
Merge pull request #7 from ropable/dependabot/github_actions/docker/m…
ropable Nov 28, 2023
78e10ea
Merge pull request #9 from ropable/dependabot/github_actions/docker/b…
ropable Nov 28, 2023
9ad13a0
Bump docker/setup-buildx-action from 2 to 3
dependabot[bot] Nov 28, 2023
797b616
Merge pull request #8 from ropable/dependabot/github_actions/docker/s…
ropable Nov 28, 2023
e3997d5
Merge branch 'master' of github.com:ropable/ibms
ropable Nov 28, 2023
83f2192
Bump Django, psycopg2, whitenoise minor versions.
ropable Nov 28, 2023
7b18b2f
Update settings to automatically infer project version.
ropable Nov 28, 2023
a7fc1ce
Increment overlays/prod/deployment_patch.yaml image tag.
ropable Nov 28, 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
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "weekly"
10 changes: 5 additions & 5 deletions .github/workflows/image-build-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ jobs:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=true
- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
# Checkout repo and set up Python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
id: setup-python
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: local
hooks:
- id: trufflehog
name: TruffleHog
description: Detect secrets in your data.
entry: bash -c 'trufflehog git file://. --since-commit HEAD --only-verified --fail --no-update'
# For running trufflehog in docker, use the following entry instead:
# entry: bash -c 'docker run --rm -v "$(pwd):/workdir" -i --rm trufflesecurity/trufflehog:latest git file:///workdir --since-commit HEAD --only-verified --fail'
language: system
stages: ["commit", "push"]
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# syntax=docker/dockerfile:1
# Prepare the base environment.
FROM python:3.10.12-slim-bookworm as builder_base_ibms
FROM python:3.10.13-slim as builder_base_ibms
MAINTAINER [email protected]
LABEL org.opencontainers.image.source https://github.com/dbca-wa/ibms

Expand All @@ -18,7 +19,7 @@ COPY poetry.lock pyproject.toml ./
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi --only main

# Install a non-root user.
# Create a non-root user.
ARG UID=10001
ARG GID=10001
RUN groupadd -g "${GID}" appuser \
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,16 @@ Run console commands manually:
To build a new Docker image from the `Dockerfile`:

docker image build -t ghcr.io/dbca-wa/ibms .

# Pre-commit hooks

This project includes the following pre-commit hooks:

- TruffleHog (credential scanning): https://github.com/marketplace/actions/trufflehog-oss

Pre-commit hooks may have additional system dependencies to run. Optionally
install pre-commit hooks locally like so:

poetry run pre-commit install

Reference: https://pre-commit.com/
4 changes: 3 additions & 1 deletion ibms_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
from pathlib import Path
import sys
import tomli

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = str(Path(__file__).resolve().parents[1])
Expand Down Expand Up @@ -80,7 +81,8 @@
]
SITE_TITLE = 'Integrated Business Management System'
SITE_ACRONYM = 'IBMS'
APPLICATION_VERSION_NO = '2.8.1'
project = tomli.load(open(os.path.join(BASE_DIR, "pyproject.toml"), "rb"))
APPLICATION_VERSION_NO = project["tool"]["poetry"]["version"]
MANAGERS = (
('Zen Wee', '[email protected]', '9219 9928'),
('Graham Holmes', '[email protected]', '9881 9212'),
Expand Down
2 changes: 2 additions & 0 deletions kustomize/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ spec:
spec:
containers:
- name: ibms
image: ghcr.io/dbca-wa/ibms
imagePullPolicy: Always
env:
- name: ALLOWED_HOSTS
value: ".dbca.wa.gov.au"
Expand Down
4 changes: 2 additions & 2 deletions kustomize/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
resources:
- deployment.yaml
- service.yaml
- deployment.yaml
- service.yaml
1 change: 0 additions & 1 deletion kustomize/overlays/prod/deployment_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ spec:
spec:
containers:
- name: ibms
image: ghcr.io/dbca-wa/ibms:2.8.1
imagePullPolicy: IfNotPresent
env:
- name: IBMS_URL
Expand Down
27 changes: 15 additions & 12 deletions kustomize/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
nameSuffix: -prod
secretGenerator:
- name: ibms-env
type: Opaque
envs:
- .env
- name: ibms-env
type: Opaque
envs:
- .env
resources:
- ../../base
- ingress.yaml
- pdb.yaml
- ../../base
- ingress.yaml
- pdb.yaml
labels:
- includeSelectors: true
pairs:
variant: prod
- includeSelectors: true
pairs:
variant: prod
images:
- name: ghcr.io/dbca-wa/ibms
newTag: 2.8.2
patches:
- path: deployment_patch.yaml
- path: service_patch.yaml
- path: deployment_patch.yaml
- path: service_patch.yaml
2 changes: 0 additions & 2 deletions kustomize/overlays/uat/deployment_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ spec:
spec:
containers:
- name: ibms
image: ghcr.io/dbca-wa/ibms
imagePullPolicy: Always
env:
- name: IBMS_URL
value: "https://ibms-uat.dbca.wa.gov.au"
Expand Down
24 changes: 12 additions & 12 deletions kustomize/overlays/uat/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
nameSuffix: -uat
secretGenerator:
- name: ibms-env
type: Opaque
envs:
- .env
- name: ibms-env
type: Opaque
envs:
- .env
resources:
- ../../base
- ingress.yaml
- pdb.yaml
- ../../base
- ingress.yaml
- pdb.yaml
labels:
- includeSelectors: true
pairs:
variant: uat
- includeSelectors: true
pairs:
variant: uat
patches:
- path: deployment_patch.yaml
- path: service_patch.yaml
- path: deployment_patch.yaml
- path: service_patch.yaml
Loading