Skip to content

Commit f2fc6b0

Browse files
authored
fix: ui-audit, weavetooling rename, ci run_release_jobs (weaveworks#5314)
1 parent 814dd26 commit f2fc6b0

File tree

11 files changed

+181
-85
lines changed

11 files changed

+181
-85
lines changed

.github/workflows/ci.yaml

Lines changed: 70 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# CI: proto and commitlint; fan-out Go (fmt, lint, unit-tests) || UI (ui-lint, ui-test);
22
# then build (gitops, gitops-server). On tag: image, chart, goreleaser.
33
#
4-
# Flow: pr-title-lint (if PR; else skipped) -> conventional-commits (if !tag;
5-
# runs when pr-title-lint success or skipped) -> proto (make proto, git diff)
6-
# in parallel with ui-lint, ui-test. Then go-fmt,
7-
# go-lint, go-unit-tests (need proto). Then build
8-
# (make gitops, make gitops-server). Tag jobs (image, chart, goreleaser) need build.
4+
# Flow: vars (sets run_release_jobs: true when ref is v* tag OR workflow_dispatch with run_release_jobs=true) and conventional-commits run first.
5+
# conventional-commits -> pr-title-lint (if PR), proto, ui-lint, ui-test -> go-* -> build.
6+
# Release jobs (build-push-gitops-server, build-and-push-chart, goreleaser) need [build, vars] and
7+
# if: needs.vars.outputs.run_release_jobs == 'true'.
8+
# workflow_dispatch input run_release_jobs is the sentinel when release.yaml (or manual) invokes CI via API.
99
# No make clean (each run is a fresh checkout).
1010
#
1111
# On tag (v*): build-push-gitops-server (provenance, SBOM, cosign), build-and-push-chart
@@ -15,11 +15,17 @@ name: CI
1515

1616
on:
1717
push:
18-
branches: [main, feature/re-implement-workflows]
18+
branches: [main]
1919
tags: ["v*"]
2020
pull_request:
21-
branches: [main, feature/re-implement-workflows]
21+
branches: [main]
2222
workflow_dispatch:
23+
inputs:
24+
run_release_jobs:
25+
description: "Run image, chart and goreleaser jobs (release build). Set when dispatching to (re-)run release, or when invoked by release.yaml."
26+
required: false
27+
default: false
28+
type: boolean
2329

2430
concurrency:
2531
group: ${{ github.workflow }}-${{ github.ref }}
@@ -33,8 +39,33 @@ env:
3339
PYTHON_VERSION: "3.12"
3440

3541
jobs:
42+
vars:
43+
name: Set CI vars
44+
runs-on: ubuntu-latest
45+
outputs:
46+
run_release_jobs: ${{ steps.set_vars.outputs.is_release_tag == 'true' || (github.event_name == 'workflow_dispatch' && github.event.inputs.run_release_jobs == 'true') }}
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: actions/setup-python@v5
50+
with:
51+
python-version: "3.12"
52+
cache: "pip"
53+
- run: pip install -e ./tooling
54+
- id: set_vars
55+
run: echo "is_release_tag=$(weavetooling ci is-tag)" >> $GITHUB_OUTPUT
56+
57+
conventional-commits:
58+
name: Conventional Commits
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
- uses: wagoid/commitlint-github-action@v5
65+
3666
pr-title-lint:
3767
name: Validate PR title
68+
needs: [conventional-commits]
3869
runs-on: ubuntu-latest
3970
if: github.event_name == 'pull_request'
4071
permissions:
@@ -71,21 +102,36 @@ jobs:
71102
header: pr-title-lint-error
72103
delete: true
73104

74-
conventional-commits:
75-
name: Conventional Commits
105+
ui-lint:
106+
name: UI lint
76107
needs: [pr-title-lint]
77108
runs-on: ubuntu-latest
78-
if: always() && (needs.pr-title-lint.result == 'success' || needs.pr-title-lint.result == 'skipped') && !startsWith(github.ref, 'refs/tags/')
79109
steps:
80110
- uses: actions/checkout@v4
111+
- uses: actions/setup-node@v4
81112
with:
82-
fetch-depth: 0
83-
- uses: wagoid/commitlint-github-action@v5
113+
node-version-file: package.json
114+
cache: yarn
115+
- run: make node_modules
116+
- run: make ui-lint
117+
- run: make ui-audit
84118

119+
ui-test:
120+
name: UI test
121+
needs: [pr-title-lint]
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: actions/checkout@v4
125+
- uses: actions/setup-node@v4
126+
with:
127+
node-version-file: package.json
128+
cache: yarn
129+
- run: make node_modules
130+
- run: make ui-test
131+
85132
proto:
86133
name: Proto (generate + git diff)
87-
needs: [conventional-commits]
88-
if: always() && (needs.conventional-commits.result == 'success' || needs.conventional-commits.result == 'skipped')
134+
needs: [pr-title-lint]
89135
runs-on: ubuntu-latest
90136
steps:
91137
- uses: actions/checkout@v4
@@ -101,7 +147,7 @@ jobs:
101147

102148
go-fmt:
103149
name: Go fmt
104-
needs: [proto]
150+
needs: [proto, ui-lint, ui-test]
105151
runs-on: ubuntu-latest
106152
steps:
107153
- uses: actions/checkout@v4
@@ -112,7 +158,7 @@ jobs:
112158

113159
go-lint:
114160
name: Go lint
115-
needs: [proto]
161+
needs: [proto, ui-lint, ui-test]
116162
runs-on: ubuntu-latest
117163
steps:
118164
- uses: actions/checkout@v4
@@ -123,7 +169,7 @@ jobs:
123169

124170
go-unit-tests:
125171
name: Go unit-tests
126-
needs: [proto]
172+
needs: [proto, ui-lint, ui-test]
127173
runs-on: ubuntu-latest
128174
steps:
129175
- uses: actions/checkout@v4
@@ -141,41 +187,9 @@ jobs:
141187
version: ${{ steps.get_flux_version.outputs.version }}
142188
- run: make unit-tests
143189

144-
ui-lint:
145-
name: UI lint
146-
needs: [conventional-commits]
147-
if: always() && (needs.conventional-commits.result == 'success' || needs.conventional-commits.result == 'skipped')
148-
runs-on: ubuntu-latest
149-
steps:
150-
- uses: actions/checkout@v4
151-
- uses: actions/setup-node@v4
152-
with:
153-
node-version-file: package.json
154-
cache: yarn
155-
- run: make node_modules
156-
- run: make ui-lint
157-
# Re-enable after workflow re-org when ui-audit errors are fixed
158-
- name: UI audit (skipped)
159-
if: false
160-
run: make ui-audit
161-
162-
ui-test:
163-
name: UI test
164-
needs: [conventional-commits]
165-
if: always() && (needs.conventional-commits.result == 'success' || needs.conventional-commits.result == 'skipped')
166-
runs-on: ubuntu-latest
167-
steps:
168-
- uses: actions/checkout@v4
169-
- uses: actions/setup-node@v4
170-
with:
171-
node-version-file: package.json
172-
cache: yarn
173-
- run: make node_modules
174-
- run: make ui-test
175-
176190
build:
177191
name: Build (gitops, gitops-server)
178-
needs: [go-fmt, go-lint, go-unit-tests, ui-lint, ui-test]
192+
needs: [go-fmt, go-lint, go-unit-tests]
179193
runs-on: ubuntu-latest
180194
steps:
181195
- uses: actions/checkout@v4
@@ -188,8 +202,8 @@ jobs:
188202
# --- Tag-only: image, chart, goreleaser ---
189203
build-push-gitops-server:
190204
name: Build and push gitops-server image
191-
needs: [build]
192-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && needs.build.result == 'success'
205+
needs: [build, vars]
206+
if: needs.vars.outputs.run_release_jobs == 'true'
193207
runs-on: ubuntu-latest
194208
permissions:
195209
contents: read
@@ -251,8 +265,8 @@ jobs:
251265
252266
build-and-push-chart:
253267
name: Build and push Helm chart
254-
needs: [build]
255-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && needs.build.result == 'success'
268+
needs: [build, vars]
269+
if: needs.vars.outputs.run_release_jobs == 'true'
256270
runs-on: ubuntu-latest
257271
permissions:
258272
contents: read
@@ -296,8 +310,8 @@ jobs:
296310
297311
goreleaser:
298312
name: Goreleaser (gitops CLI)
299-
needs: [build]
300-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && needs.build.result == 'success'
313+
needs: [build, vars]
314+
if: needs.vars.outputs.run_release_jobs == 'true'
301315
runs-on: ubuntu-latest
302316
permissions:
303317
contents: write

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
7676
- name: Bump version (Chart, values, package.json)
7777
id: bump
78-
run: tooling/.venv/bin/weavegitops release bump ${{ env.BUMP }}
78+
run: tooling/.venv/bin/weavetooling release bump ${{ env.BUMP }}
7979

8080
- name: Check for changes
8181
run: |
@@ -89,7 +89,7 @@ jobs:
8989
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
9090
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
9191
run: |
92-
tooling/.venv/bin/weavegitops release generate-notes \
92+
tooling/.venv/bin/weavetooling release generate-notes \
9393
--version ${{ steps.bump.outputs.version }} \
9494
--output release-body.md \
9595
--template .github/release-notes-template.md \

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"homepage": "https://github.com/weaveworks/weave-gitops#readme",
4545
"peerDependencies": {
46-
"lodash": "^4.17.21",
46+
"lodash": "^4.17.23",
4747
"react": "^19.0.0",
4848
"react-dom": "^19.0.0",
4949
"react-toastify": "^7.0.4",
@@ -64,8 +64,8 @@
6464
"install": "^0.13.0",
6565
"jest-canvas-mock": "^2.5.2",
6666
"js-sha3": "0.9.3",
67-
"js-yaml": "^4.1.0",
68-
"lodash": "^4.17.21",
67+
"js-yaml": "^4.1.1",
68+
"lodash": "^4.17.23",
6969
"luxon": "^3.7.2",
7070
"mnemonic-browser": "^0.0.1",
7171
"postcss": "^8.5.6",
@@ -75,7 +75,7 @@
7575
"react-is": "^19.0.0",
7676
"react-lottie-player": "^2.1.0",
7777
"react-markdown": "^10.1.0",
78-
"react-router": "^7.6.3",
78+
"react-router": "^7.12.0",
7979
"react-syntax-highlighter": "^15.6.1",
8080
"react-toastify": "^11.0.5",
8181
"remark-gfm": "^4.0.1",

tooling/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ Release and build tooling for Weave GitOps.
44

55
## Commands
66

7-
- **weavegitops release bump** [patch|minor|major|rc|patch-rc|minor-rc|major-rc]
7+
- **weavetooling release bump** [patch|minor|major|rc|patch-rc|minor-rc|major-rc]
88
Bump from `charts/gitops-server/Chart.yaml`; updates Chart, values, package.json. **rc**: `0.39.0-rc.2``0.39.0-rc.3` or `0.39.0``0.39.0-rc.1`. **minor-rc**: `0.39.x``0.40.0-rc.1` (start RC for next minor). Also **patch-rc**, **major-rc**. Writes `version` to `GITHUB_OUTPUT` when set.
99

10-
- **weavegitops release generate-notes** --version X.Y.Z [--output PATH] [--template PATH] [--since-tag TAG] [--provider openai|anthropic]
10+
- **weavetooling release generate-notes** --version X.Y.Z [--output PATH] [--template PATH] [--since-tag TAG] [--provider openai|anthropic]
1111
Generate release notes from commits since the previous tag via OpenAI or Anthropic.
1212

13+
- **weavetooling ci is-tag**
14+
Print `true` if `GITHUB_REF` starts with `refs/tags/v`, else `false`. Used in CI vars job: the step sets `is_release_tag` (e.g. `echo "is_release_tag=$(weavetooling ci is-tag)" >> $GITHUB_OUTPUT`); the job then exposes `run_release_jobs` (true when `is_release_tag` or `workflow_dispatch` with `run_release_jobs` input) for downstream release jobs.
15+
1316
## Install
1417

1518
```bash

tooling/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dev = [
2121
]
2222

2323
[project.scripts]
24-
weavegitops = "weave_gitops_tooling.cli:main"
24+
weavetooling = "weave_gitops_tooling.cli:main"
2525

2626
[tool.setuptools.packages.find]
2727
where = ["src"]

tooling/src/weave_gitops_tooling/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""CLI for weavegitops."""
1+
"""CLI for weavetooling."""
22

33
from .main import main
44

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""CI helper commands (is-tag, etc.)."""
2+
3+
import os
4+
5+
6+
def run_ci(args) -> None:
7+
if getattr(args, "ci_cmd", None) == "is-tag":
8+
_run_is_tag()
9+
return
10+
raise SystemExit("weavetooling ci: use is-tag. Run: weavetooling ci --help")
11+
12+
13+
def _run_is_tag() -> None:
14+
"""Print 'true' if GITHUB_REF starts with refs/tags/v, else 'false'. For GHA job outputs."""
15+
ref = os.environ.get("GITHUB_REF", "")
16+
print("true" if ref.startswith("refs/tags/v") else "false")

tooling/src/weave_gitops_tooling/cli/main.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
"""weavegitops CLI entry point."""
1+
"""weavetooling CLI entry point."""
22

33
import os
44
import sys
55
from pathlib import Path
66

77
from . import release as release_cli
8+
from . import ci as ci_cli
89

910

1011
def _get_project_root() -> Path:
@@ -26,23 +27,32 @@ def main() -> None:
2627

2728
if args.command == "release":
2829
if not getattr(args, "release_cmd", None):
29-
print("weavegitops release: missing subcommand")
30+
print("weavetooling release: missing subcommand")
3031
print(" bump, generate-notes")
31-
print(" Use: weavegitops release --help")
32+
print(" Use: weavetooling release --help")
3233
sys.exit(1)
3334
release_cli.run_release(args, project_root)
3435
return
3536

36-
print("weavegitops: use 'release' (bump, generate-notes).")
37+
if args.command == "ci":
38+
if not getattr(args, "ci_cmd", None):
39+
print("weavetooling ci: missing subcommand")
40+
print(" is-tag")
41+
print(" Use: weavetooling ci --help")
42+
sys.exit(1)
43+
ci_cli.run_ci(args)
44+
return
45+
46+
print("weavetooling: use 'release' (bump, generate-notes) or 'ci' (is-tag).")
3747
sys.exit(1)
3848

3949

4050
def _build_parser():
4151
import argparse
4252

4353
p = argparse.ArgumentParser(
44-
prog="weavegitops",
45-
description="Weave GitOps tooling: release bump, generate-notes",
54+
prog="weavetooling",
55+
description="Weave GitOps tooling: release bump, generate-notes, ci helpers",
4656
)
4757
sub = p.add_subparsers(dest="command", help="Command")
4858

@@ -83,4 +93,8 @@ def _build_parser():
8393
help="Model: OpenAI (gpt-4o-mini) or Anthropic (claude-sonnet-4-5-20250929)",
8494
)
8595

96+
pci = sub.add_parser("ci", help="CI helpers: is-tag (for GHA job outputs)")
97+
pci_sub = pci.add_subparsers(dest="ci_cmd")
98+
pci_sub.add_parser("is-tag", help="Print true if GITHUB_REF is refs/tags/v*, else false")
99+
86100
return p

0 commit comments

Comments
 (0)