-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from canonical/create_basic_rock_including_expo…
…rter [DPE-4523] create basic rock for redis including metrics exporter
- Loading branch information
Showing
3 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Build ROCK | ||
|
||
on: | ||
workflow_call: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Setup LXD | ||
uses: canonical/setup-lxd@main | ||
- name: Install dependencies | ||
run: | | ||
sudo snap install yq | ||
sudo snap install rockcraft --classic | ||
- name: Build ROCK | ||
run: | | ||
rockcraft pack | ||
- name: Upload locally built ROCK artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: redis-rock | ||
path: charmed-redis_*_amd64.rock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Publish to GHCR | ||
|
||
env: | ||
RELEASE: edge | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yaml | ||
publish: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Setup Docker | ||
run: | | ||
sudo snap install docker | ||
sudo addgroup --system docker; sudo adduser $USER docker | ||
newgrp docker | ||
sudo snap disable docker; sudo snap enable docker | ||
- name: Install skopeo | ||
run: | | ||
sudo snap install --devmode --channel edge skopeo | ||
- name: Install yq | ||
run: | | ||
sudo snap install yq | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: redis-rock | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.GHCR_USER }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
- name: Import and push to GHCR | ||
run: | | ||
version=$(yq '(.version|split("-"))[0]' rockcraft.yaml) | ||
rock_image_version=$(yq '(.version)' rockcraft.yaml) | ||
base=$(yq '(.base|split("@"))[1]' rockcraft.yaml) | ||
tag=${version}-${base}-${{ env.RELEASE }} | ||
echo "Publishing charmed-redis:${tag}" | ||
sudo skopeo --insecure-policy copy \ | ||
oci-archive:charmed-redis_${rock_image_version}_amd64.rock \ | ||
docker-daemon:ghcr.io/canonical/charmed-redis:${tag} | ||
docker push ghcr.io/canonical/charmed-redis:${tag} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2024 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
--- | ||
name: charmed-redis # the name of your ROCK | ||
base: [email protected] # the base environment for this ROCK | ||
version: '7.2.5' # just for humans. Semantic versioning is recommended | ||
summary: Charmed Redis ROCK OCI # 79 char long summary | ||
description: | | ||
This is an OCI image that bundles Redis together with the metrics exporter | ||
in order to be used in Charmed Operators, providing automated operations | ||
management from day 0 to day 2 on Redis, on top of a Virtual Machine cluster | ||
and K8s cluster. It is an open source, end-to-end, production ready data | ||
platform on top of cloud native technologies. | ||
license: Apache-2.0 # your application's SPDX license | ||
|
||
platforms: # The platforms this ROCK should be built on and run on | ||
amd64: | ||
|
||
services: | ||
redis: | ||
override: replace | ||
startup: enabled | ||
summary: Start Redis | ||
command: "redis-server" | ||
redis_exporter: | ||
override: replace | ||
startup: enabled | ||
summary: Start Redis Exporter | ||
command: "/bin/redis_exporter" | ||
|
||
parts: | ||
redis: | ||
plugin: nil | ||
stage-packages: | ||
- redis | ||
redis_exporter: | ||
plugin: go | ||
source: https://github.com/canonical/redis_exporter.git | ||
source-type: git | ||
source-branch: "v1.60.0" | ||
build-snaps: | ||
- go/1.21/stable |