Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation #1

Merged
merged 11 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
27 changes: 27 additions & 0 deletions .github/workflows/build.yaml
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@v3
with:
name: valkey-rock
path: charmed-valkey_*_amd64.rock
55 changes: 55 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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: valkey-rock
path: .
- 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-valkey:${tag}"
sudo skopeo --insecure-policy copy \
oci-archive:charmed-valkey_${rock_image_version}_amd64.rock \
docker-daemon:ghcr.io/canonical/charmed-valkey:${tag}
docker push ghcr.io/canonical/charmed-valkey:${tag}
7 changes: 7 additions & 0 deletions README.md
reneradoi marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Charmed Valkey rock
reneradoi marked this conversation as resolved.
Show resolved Hide resolved
This repository will contain the packaging metadata for creating a rock of Charmed Valkey built from Charmed Valkey
Snap.

License
reneradoi marked this conversation as resolved.
Show resolved Hide resolved
The Charmed Valkey rock is free software, distributed under the Apache Software License, version 2.0. See licenses for
more information.
File renamed without changes.
49 changes: 49 additions & 0 deletions licenses/LICENSE-valkey
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# License 1

BSD 3-Clause License

Copyright (c) 2024-present, Valkey contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# License 2

BSD 3-Clause License

Copyright (c) 2006-2020, Salvatore Sanfilippo
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Redis nor the names of its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 changes: 51 additions & 0 deletions rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE-rock file for licensing details.
---
name: charmed-valkey # the name of your ROCK
base: ubuntu@22.04 # the base environment for this ROCK
version: '7.2.5' # just for humans. Semantic versioning is recommended
summary: Charmed Valkey ROCK OCI # 79 char long summary
description: |
This is an OCI image that bundles Valkey together with the metrics exporter
in order to be used in Charmed Operators, providing automated operations
management from day 0 to day 2 on Valkey, 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:
valkey:
override: replace
startup: enabled
summary: Start Valkey
command: "valkey-server"
reneradoi marked this conversation as resolved.
Show resolved Hide resolved
redis_exporter:
override: replace
startup: enabled
summary: Start Metrics Exporter
command: "/bin/redis_exporter"

parts:
valkey-user:
plugin: nil
overlay-script: |
set -x
useradd -R $CRAFT_OVERLAY -M -U -r valkey
reneradoi marked this conversation as resolved.
Show resolved Hide resolved
valkey:
plugin: nil
after:
- valkey-user
stage-snaps:
- charmed-valkey/latest/edge
redis_exporter:
plugin: go
after:
- valkey
source: https://github.com/canonical/redis_exporter.git
source-type: git
source-branch: "v1.60.0"
build-snaps:
- go/1.21/stable
Loading