Skip to content

Commit

Permalink
Merge pull request #214 from stackrox/stage
Browse files Browse the repository at this point in the history
sync: stage to production
  • Loading branch information
stehessel authored Mar 6, 2024
2 parents 78f7afe + 76fadae commit 63523e6
Show file tree
Hide file tree
Showing 12 changed files with 904 additions and 169 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ resources/grafana/generated/** linguist-generated=true
resources/grafana/mixins/** linguist-generated=true
resources/prometheus/kubernetes-mixin-alerts.yaml linguist-generated=true
resources/prometheus/kubernetes-mixin-rules.yaml linguist-generated=true
resources/prometheus/federation-config.yaml linguist-generated=true
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
run: |
curl -s -S -L -o /tmp/promtool https://github.com/prometheus/prometheus/releases/download/v2.36.0/prometheus-2.36.0.linux-amd64.tar.gz
tar -zxf /tmp/promtool --strip-components=1 --directory /usr/local/bin &> /dev/null
- name: Install mimirtool
run: |
curl --silent --show-error --fail --location https://github.com/grafana/mimir/releases/download/mimir-2.10.5/mimirtool-linux-amd64 --output /usr/local/bin/mimirtool
echo "72f46c82c303c48566844612f83ab53d4b804c665644163ad7f0f8945caa0521 /usr/local/bin/mimirtool" | sha256sum --check --status
chmod +x /usr/local/bin/mimirtool
- name: Patch PATH to include GOBIN
run: echo "PATH=$(echo $PATH):/home/runner/go/bin" >> $GITHUB_ENV
- uses: pre-commit/action@v3.0.1
4 changes: 3 additions & 1 deletion .github/workflows/sync-prod-from-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ jobs:
uses: actions/checkout@v4
- name: Opening pull request
id: pull
uses: tretuna/sync-branches@1.4.0
# We need main for PULL_REQUEST_AUTO_MERGE_METHOD, which is currently not yet released.
uses: tretuna/sync-branches@main
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
FROM_BRANCH: "stage"
TO_BRANCH: "production"
PULL_REQUEST_AUTO_MERGE_METHOD: merge
4 changes: 3 additions & 1 deletion .github/workflows/sync-stage-from-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ jobs:
uses: actions/checkout@v4
- name: Opening pull request
id: pull
uses: tretuna/sync-branches@1.4.0
# We need main for PULL_REQUEST_AUTO_MERGE_METHOD, which is currently not yet released.
uses: tretuna/sync-branches@main
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
FROM_BRANCH: "master"
TO_BRANCH: "stage"
PULL_REQUEST_AUTO_MERGE_METHOD: merge
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
.PHONY: generate
generate:
.PHONY: generate-resources
generate-resources:
$(MAKE) -C resources/mixins/kubernetes generate
$(MAKE) -C resources/grafana generate

.PHONY: generate-federate
generate-federate:
@scripts/generate-federate-match.sh

.PHONY: generate
generate: generate-resources generate-federate

.PHONY: update
update:
$(MAKE) -C resources/mixins/kubernetes update
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ GitHub actions to trigger branch synchronization.

## Contributing

### Prerequisites

The following tools are required for development:
- `jq` - please follow [the installation instructions](https://jqlang.github.io/jq/download).
- `mimirtool` - please follow [the installation instructions](https://grafana.com/docs/mimir/latest/manage/tools/mimirtool/#installation).
- `yq` - please follow [the installation instructions](https://github.com/mikefarah/yq/#install).

### Dashboards

To make changes to the rhacs dashboards:
Expand All @@ -48,6 +55,15 @@ Then:
* Update `resources/mixins/kubernetes/mixin.libsonnet`.
* Run `make generate` to generate the corresponding mixin resources.

### Federated metrics

If you make changes to Alerts, Recording rules, or Grafana dashboards, and if they include metrics collected by OSD Prometheus, ensure that the federation config includes new metrics.

* Run `make generate-federate` to update federation config.
* And commit changes in `resources/prometheus/federation-config.yaml` file to the repo.

You can add additional federated metrics that are not used in any Alert, Recording rule, or Grafana dashboard to `resources/prometheus/federation-config-base.yaml,` and they will be merged with other metrics. Always add a comment with the reason why metrics are added to the base list.

### Pre-commit hook

This repository makes use of [pre-commit](https://pre-commit.com/) framework. Refer to the [installation instructions](https://pre-commit.com/#installation) for further information.
Expand Down
Loading

0 comments on commit 63523e6

Please sign in to comment.