diff --git a/.github/workflows/rock-update.yaml b/.github/workflows/rock-update.yaml index b264669..36be030 100644 --- a/.github/workflows/rock-update.yaml +++ b/.github/workflows/rock-update.yaml @@ -3,7 +3,7 @@ name: Update rock on: workflow_dispatch: {} schedule: - - cron: '0 0,4,8,12,16,20 * * *' + - cron: '0 0 * * *' jobs: build: @@ -21,3 +21,4 @@ jobs: node_version="\$(sed -En 's|\s*"@types/node":\s*"\^*([0-9]+)(\.[0-9])+.*",|\1|p' \$application_src/web/ui/package.json)" yq -i 'del(.parts.prometheus.build-snaps.[] | select(. == "node/*"))' "\$rockcraft_yaml" ver="\$node_version" yq -i '.parts.prometheus.build-snaps += "node/"+strenv(ver)+"/stable"' "\$rockcraft_yaml" + secrets: inherit diff --git a/2.52.0/rockcraft.yaml b/2.52.0/rockcraft.yaml index 0c5f159..be3b6fc 100644 --- a/2.52.0/rockcraft.yaml +++ b/2.52.0/rockcraft.yaml @@ -2,8 +2,7 @@ name: prometheus summary: Prometheus in a rock. description: "Prometheus is time-series database for metrics collection and query, driven by either API or a web ui" version: "2.52.0" -base: ubuntu:22.04 -build-base: ubuntu:22.04 +base: ubuntu@24.04 license: Apache-2.0 services: prometheus: diff --git a/README.md b/README.md index 9a90a4f..282ffff 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,18 @@ This repository holds all the necessary files to build rocks for the upstream ve The rocks on this repository are built with [OCI Factory](https://github.com/canonical/oci-factory/), which also takes care of periodically rebuilding the images. +``` +∮ just +Available recipes: + clean version # `rockcraft clean` for a specific version + pack version # Pack a rock of a specific version + run version=latest_version # Run a rock and open a shell into it with `kgoss` + test version=latest_version # Test the rock with `kgoss` +``` + Automation takes care of: * validating PRs, by simply trying to build the rock; * pulling upstream releases, creating a PR with the necessary files to be manually reviewed; +* on PRs, validate the added (or modified) rocks by running `kgoss`; * releasing to GHCR at [ghcr.io/canonical/prometheus:dev](https://ghcr.io/canonical/prometheus:dev), when merging to main, for development purposes. diff --git a/goss.yaml b/goss.yaml new file mode 100644 index 0000000..db886ec --- /dev/null +++ b/goss.yaml @@ -0,0 +1,13 @@ +process: + prometheus: + running: true +http: + config: + status: 200 + url: http://localhost:9090/api/v1/status/config + buildinfo: + status: 200 + url: http://localhost:9090/api/v1/status/buildinfo + targets : + status: 200 + url: http://localhost:9090/api/v1/targets diff --git a/justfile b/justfile new file mode 100644 index 0000000..c4cc552 --- /dev/null +++ b/justfile @@ -0,0 +1,33 @@ +set quiet # Recipes are silent by default +set export # Just variables are exported to environment variables + +rock_name := `echo ${PWD##*/} | sed 's/-rock//'` +latest_version := `find . -maxdepth 1 -type d | sort -V | tail -n1 | sed 's@./@@'` + +[private] +default: + just --list + +# Push an OCI image to a local registry +[private] +push-to-registry version: + echo "Pushing $rock_name $version to local registry" + rockcraft.skopeo --insecure-policy copy --dest-tls-verify=false \ + "oci-archive:${version}/${rock_name}_${version}_amd64.rock" \ + "docker://localhost:32000/${rock_name}-dev:${version}" + +# Pack a rock of a specific version +pack version: + cd "$version" && rockcraft pack + +# `rockcraft clean` for a specific version +clean version: + cd "$version" && rockcraft clean + +# Run a rock and open a shell into it with `kgoss` +run version=latest_version: (push-to-registry version) + kgoss edit -i localhost:32000/${rock_name}-dev:${version} + +# Test the rock with `kgoss` +test version=latest_version: (push-to-registry version) + GOSS_OPTS="--retry-timeout 60s" kgoss run -i localhost:32000/${rock_name}-dev:${version}