Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/workflows/asyncapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
tags:
- '*'
pull_request:
merge_group:
types: [checks_requested]

jobs:
validate:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/backstage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
tags:
- '*'
pull_request:
merge_group:
types: [checks_requested]

jobs:
validate:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
tags:
- "*"
pull_request:
merge_group:
types: [checks_requested]

jobs:
lint:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ on:
tags:
- '*'
pull_request:

merge_group:
types: [checks_requested]

jobs:
analyze:
Expand Down Expand Up @@ -61,7 +62,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@38697555549f1db7851b81482ff19f1fa5c4fedc # v4
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
Expand All @@ -88,6 +89,6 @@ jobs:
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@38697555549f1db7851b81482ff19f1fa5c4fedc # v4
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4
with:
category: "/language:${{matrix.language}}"
6 changes: 4 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ name: PR Conventional Commit Validation
on:
pull_request:
types: [opened, synchronize, reopened, edited]
merge_group:
types: [checks_requested]

jobs:
validate-pr-title:
runs-on: ubuntu-latest
steps:
- name: PR Conventional Commit Validation
uses: ytanikin/pr-conventional-commits@1.5.2
uses: ytanikin/pr-conventional-commits@1.5.2
with:
task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert", "depr"]'
add_label: 'false'
add_label: "false"
2 changes: 2 additions & 0 deletions docs/tutorials/scripting-plans.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ This will be one of `WorkerEvent`, `ProgressEvent` or `DataEvent`.
An example that prints data for each point could be something like

```python
from blueapi.core.bluesky_types import DataEvent

def feedback(evt):
match evt:
case DataEvent(name="start"):
Expand Down
2 changes: 1 addition & 1 deletion helm/blueapi/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application

# This is the chart version. This version number is incremented by the release process.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 1.12.2

# This is the version number of the application being deployed. This version number is incremented by the release process.
# Versions are not expected to follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
78 changes: 78 additions & 0 deletions helm/blueapi/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "blueapi.fullname" . }}-last-used-stamper
namespace: {{ .Release.Namespace }}
automountServiceAccountToken: true
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "blueapi.fullname" . }}-last-used-stamper
namespace: {{ .Release.Namespace }}
rules:
- apiGroups: [""]
resources: ["pods", "persistentvolumeclaims"]
verbs: ["get", "list", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "blueapi.fullname" . }}-last-used-stamper
namespace: {{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
name: {{ include "blueapi.fullname" . }}-last-used-stamper
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
name: {{ include "blueapi.fullname" . }}-last-used-stamper
apiGroup: rbac.authorization.k8s.io
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "blueapi.fullname" . }}-last-used-stamper
namespace: {{ .Release.Namespace }}
spec:
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1
schedule: "*/5 * * * *"
jobTemplate:
spec:
# amount of attempts of labeling a pvc
backoffLimit: 2
# job stops after 60 secounds
activeDeadlineSeconds: 60
template:
spec:
serviceAccountName: {{ include "blueapi.fullname" . }}-last-used-stamper
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 12 }}
{{- end }}
containers:
- name: last-used-stamper
image: bitnami/kubectl:1.31.1
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- |
# Get PVCs belonging to this blueapi release
ALL_PVC=$(kubectl get pvc -l "argocd.argoproj.io/instance={{ .Release.Name }}" \
-o jsonpath='{.items[*].metadata.name}' -n {{ .Release.Namespace }} | tr ' ' '\n')
# Get all PVCs currently mounted by running pods
MOUNTED_PVCS=$(kubectl get pods -n {{ .Release.Namespace }} \
-o=jsonpath='{.items[*].spec.volumes[*].persistentVolumeClaim.claimName}' | tr ' ' '\n' | sort -u)
NOW=$(date +%s)
for pvc in $ALL_PVC; do
ANNOTATION=$(kubectl get pvc "$pvc" -n {{ .Release.Namespace }} -o=jsonpath='{.metadata.annotations.last-used}')
if [ -z "$ANNOTATION" ]; then
kubectl annotate --overwrite pvc "$pvc" -n {{ .Release.Namespace }} last-used="$NOW"
elif echo "$MOUNTED_PVCS" | grep -qx "$pvc"; then
kubectl annotate --overwrite pvc "$pvc" -n {{ .Release.Namespace }} last-used="$NOW"
fi
done
restartPolicy: OnFailure
19 changes: 19 additions & 0 deletions helm/blueapi/templates/tests/test-cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Pod
metadata:
name: {{ include "blueapi.fullname" . }}-last-used-stamper
annotations:
"helm.sh/hook": test
spec:
serviceAccountName: {{ include "blueapi.fullname" . }}-last-used-stamper
containers:
- name: test
image: bitnami/kubectl:1.34.5
command: ["/bin/sh", "-c"]
args:
- |
# Get a pod belonging to this release and annotate it, then verify
kubectl annotate --overwrite pod "$HOSTNAME" -n "{{ .Release.Namespace }}" last-used="$(date +%s)"
kubectl get pod "$HOSTNAME" -n "{{ .Release.Namespace }}" \
-o jsonpath='{.metadata.annotations.last-used}' | grep -q .
restartPolicy: Never
Loading
Loading