Skip to content

Commit

Permalink
Adds csi-snapshotter rock (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiubelu authored Aug 2, 2024
1 parent 5542e73 commit c0ef56f
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
54 changes: 54 additions & 0 deletions csi-snapshotter/6.3.3/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2024 Canonical, Ltd.
# See LICENSE file for licensing details

# Based on: https://github.com/kubernetes-csi/external-snapshotter/blob/v6.3.3/cmd/csi-snapshotter/Dockerfile
name: csi-snapshotter
summary: csi-snapshotter rock
description: |
A rock containing the CSI snapshotter.
license: Apache-2.0
version: 6.3.3

base: bare
build-base: [email protected]
run-user: _daemon_

platforms:
amd64:
arm64:

environment:
APP_VERSION: 6.3.3

# Services to be loaded by the Pebble entrypoint.
services:
csi-snapshotter:
summary: "csi-snapshotter service"
override: replace
startup: enabled
command: "/csi-snapshotter"
on-success: shutdown
on-failure: shutdown

parts:
build-csi-snapshotter:
plugin: go
source: https://github.com/kubernetes-csi/external-snapshotter.git
source-type: git
source-tag: v${CRAFT_PROJECT_VERSION}
source-depth: 1
build-snaps:
- go/1.20/stable
build-environment:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: $CRAFT_ARCH_BUILD_FOR
- VERSION: $CRAFT_PROJECT_VERSION
- LDFLAGS: >
-X main.version=${VERSION} -extldflags "-static"
go-buildtags:
- "mod=vendor"
go-generate:
- ./cmd/csi-snapshotter
organize:
bin/csi-snapshotter: ./
18 changes: 18 additions & 0 deletions tests/sanity/test_csi_snapshotter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Copyright 2024 Canonical, Ltd.
# See LICENSE file for licensing details
#

from k8s_test_harness.util import docker_util, env_util


def test_csi_snapshotter_rock():
"""Test csi-snapshotter rock."""
rock = env_util.get_build_meta_info_for_rock_version(
"csi-snapshotter", "6.3.3", "amd64"
)
image = rock.image

# check binary.
process = docker_util.run_in_docker(image, ["/csi-snapshotter", "--help"])
assert "Usage of /csi-snapshotter" in process.stderr

0 comments on commit c0ef56f

Please sign in to comment.