Skip to content

Commit 075bd58

Browse files
authored
Merge pull request #62 from DXC-DP-Monitoring/staging
Merge Green Branch (#61)
2 parents 26e3557 + d2c52b5 commit 075bd58

File tree

6 files changed

+70
-13
lines changed

6 files changed

+70
-13
lines changed

.github/workflows/cd.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches: [ main ]
66
workflow_dispatch: {}
77

8+
permissions:
9+
contents: read
10+
packages: write
11+
812
env:
913
VERSION: v1.${{ github.run_number }}
1014

@@ -14,12 +18,24 @@ jobs:
1418
runs-on: ubuntu-latest
1519
steps:
1620
- uses: actions/checkout@v4
17-
- name: Build Docker (prod)
18-
run: docker build -t ghcr.io/${{ github.repository }}:${{ env.VERSION }} .
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
1925
- name: Login to GHCR
20-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
21-
- name: Push image
22-
run: |
23-
docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }}
24-
docker tag ghcr.io/${{ github.repository }}:${{ env.VERSION }} ghcr.io/${{ github.repository }}:latest
25-
docker push ghcr.io/${{ github.repository }}:latest
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Build and push (cached)
33+
uses: docker/build-push-action@v6
34+
with:
35+
context: .
36+
push: true
37+
tags: |
38+
ghcr.io/${{ github.repository }}:${{ env.VERSION }}
39+
ghcr.io/${{ github.repository }}:latest
40+
cache-from: type=gha
41+
cache-to: type=gha,mode=max

.github/workflows/ci.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,30 @@ on:
1414
- 'images/**'
1515
- 'docs/**'
1616

17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
1721
env:
1822
NIFIPULSE_AUTO_ENV: "1"
1923

2024
jobs:
2125
build-test-dev:
22-
if: github.ref == 'refs/heads/dev'
26+
if: github.ref == 'refs/heads/dev' && !(
27+
github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]') ||
28+
github.event_name == 'pull_request' && (contains(github.event.pull_request.title, '[skip ci]') || contains(github.event.pull_request.body, '[skip ci]'))
29+
)
2330
runs-on: ubuntu-latest
31+
timeout-minutes: 15
2432
steps:
2533
- uses: actions/checkout@v4
2634
- uses: actions/setup-python@v5
2735
with:
2836
python-version: '3.11'
37+
cache: 'pip'
38+
cache-dependency-path: |
39+
**/pyproject.toml
40+
**/requirements*.txt
2941
- name: Install deps
3042
run: |
3143
pip install -U pip
@@ -45,7 +57,10 @@ jobs:
4557
fi
4658
4759
integration-test-staging:
48-
if: github.event.pull_request.base.ref == 'staging'
60+
if: github.event.pull_request.base.ref == 'staging' && !(
61+
github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]') ||
62+
github.event_name == 'pull_request' && (contains(github.event.pull_request.title, '[skip ci]') || contains(github.event.pull_request.body, '[skip ci]'))
63+
)
4964
runs-on: ubuntu-latest
5065
steps:
5166
- uses: actions/checkout@v4

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616

1717
jobs:
1818
unit-integration:
19+
if: !(
20+
github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]') ||
21+
github.event_name == 'pull_request' && (contains(github.event.pull_request.title, '[skip ci]') || contains(github.event.pull_request.body, '[skip ci]'))
22+
)
1923
runs-on: ubuntu-latest
2024
services:
2125
postgres:

Readme.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,28 @@ After running `docker compose up` run:
4848
LIMIT 20;"
4949
---
5050

51+
## CI usage and “[skip ci]
52+
Our CI runs on every push to `dev` and on PRs to `staging`/`main`. To reduce waste:
53+
- CI auto-skips for docs and images via `paths-ignore`.
54+
- Optional: add `[skip ci]` in the commit message (push), or in the PR title/body (pull_request) for one-off skips.
55+
56+
Use `[skip ci]` only for:
57+
- Docs-only edits (README, Alerting.md, state_of_art PDFs).
58+
- Image asset updates under `images/`.
59+
- Non-code text changes (typos, formatting).
60+
61+
Do NOT use `[skip ci]` when changing:
62+
- Python code (`nifipulse/**`), tests (`tests/**`), dependencies (`pyproject.toml`, `requirements*.txt`).
63+
- CI/CD files (`.github/workflows/**`), Dockerfile/compose, SQL schema, Prometheus/Grafana configs.
64+
65+
Examples:
66+
- `git commit -m "docs: update Alerting.md [skip ci]" && git push`
67+
- PR title: `docs: update dashboards [skip ci]`
68+
69+
CI details:
70+
- Concurrency cancels superseded runs to save compute.
71+
- Pip caching speeds installs; lint is advisory (`continue-on-error: true`) until we enforce style.
72+
5173
## Architecture
5274
![nifi_architecture](images/nifi_archi.png)
5375

nifipulse/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def main():
1414
parser.add_argument(
1515
"--interval",
1616
type=int,
17-
default=5,
18-
help="Seconds between polling cycles (default 5)."
17+
default=60,
18+
help="Seconds between polling cycles (default 60)."
1919
)
2020
args = parser.parse_args()
2121
nifipulse(poll_count=args.poll, interval=args.interval)

nifipulse/extract_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from nifipulse.data_normalisation import process_data
1010
from nifipulse.load_postgres import load_postgres
1111

12-
def nifipulse(poll_count=10, interval=5):
12+
def nifipulse(poll_count=10, interval=60):
1313
"""
1414
poll_count: number of cycles to poll (0 = run forever)
1515
interval: seconds to wait between cycles

0 commit comments

Comments
 (0)