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

JIMM rock #1235

Merged
merged 4 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 8 additions & 2 deletions .github/workflows/server-oci-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build local images
run: make jimm-image
- name: ln rockcraft.yaml
run: ln -s ./rocks/jimm.yaml ./rockcraft.yaml

- name: Build ROCK
uses: canonical/craft-actions/rockcraft-pack@main

- name: Load ROCK into local registry
run: make load-rock

- name: Push to github package
run: |
Expand Down
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ version/version.txt: FORCE
echo $(GIT_VERSION) > version/version.txt; \
fi

jimmsrv: version/commit.txt version/version.txt
go build -tags release -v $(PROJECT)/cmd/jemd

jimm-image:
docker build --target deploy-env \
--build-arg="GIT_COMMIT=$(GIT_COMMIT)" \
Expand Down Expand Up @@ -98,8 +95,15 @@ push-microk8s: jimm-image
docker tag jimm:latest localhost:32000/jimm:latest
docker push localhost:32000/jimm:latest

get-local-auth:
@go run ./local/authy
rock:
-rm *.rock
-ln -s ./rocks/jimm.yaml ./rockcraft.yaml
rockcraft pack
-rm ./rockcraft.yaml

load-rock:
$(eval jimm_version := $(shell cat ./rocks/jimm.yaml | yq ".version"))
@sudo /snap/rockcraft/current/bin/skopeo --insecure-policy copy oci-archive:jimm_${jimm_version}_amd64.rock docker-daemon:jimm:latest
ale8k marked this conversation as resolved.
Show resolved Hide resolved

define check_dep
if ! which $(1) > /dev/null; then\
Expand Down Expand Up @@ -137,6 +141,8 @@ help:
@echo 'make format - Format the source files.'
@echo 'make simplify - Format and simplify the source files.'
@echo 'make get-local-auth - Get local auth to the API WSS endpoint locally.'
@echo 'make rock - Build the JIMM rock.'
@echo 'make load-rock - Load the most recently built rock into your local docker daemon.'

.PHONY: build check install release clean format server simplify sysdeps help FORCE

Expand Down
179 changes: 0 additions & 179 deletions local/authy/main.go

This file was deleted.

58 changes: 58 additions & 0 deletions rocks/jimm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: jimm
base: [email protected]
version: '0.1'
summary: Juju Intelligent Model Manager provides a convient way to manage all of your models!
description: |
JIMM is a Juju controller, used in conjunction with the JaaS dashboard to provide a seamless way
to manage models, regardless of where their controllers reside or what cloud they may be running on.

license: GPL-3.0
platforms:
amd64:

services:
server:
summary: JIMM
description: |
JIMM is a Juju controller, used in conjunction with the JaaS dashboard to provide a seamless way
to manage models, regardless of where their controllers reside or what cloud they may be running on.
startup: enabled
override: replace
command: jimmsrv
on-success: ignore
on-failure: restart
backoff-delay: 1s
backoff-factor: 2
backoff-limit: 10s
kill-delay: 10s

parts:
builder:
plugin: go # https://canonical-craft-parts--694.com.readthedocs.build/en/694/common/craft-parts/reference/plugins/go_plugin.html
source: .
source-type: local
build-snaps:
- go/1.22/stable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I asked this in the Livepatch rock, but is there any way to detect the go version based on our go.mod?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could in theory just yq the file in place? I'm already ln'ing it? Will check the rock spec tho see if it can pickup on go mods

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing there, merged PR, happy to just manually update tbh for now

build-packages:
- git
- make
build-environment:
- GOOS: linux
override-build: |
set -ex

mkdir -p $CRAFT_PART_INSTALL/usr/local/bin

make build/server
cp ./jimmsrv $CRAFT_PART_INSTALL/usr/local/bin

# The location of SQL files isn't configurable right now, as such we just
# place it in bin
cp -r ./internal/dbmodel/sql $CRAFT_PART_INSTALL/usr/local/bin/sql

# Copied for the charm to collect and apply, not this container itself
mkdir -p $CRAFT_PART_INSTALL/root/openfga/
cp ./openfga/authorisation_model.json $CRAFT_PART_INSTALL/root/openfga/authorisation_model.json

stage-packages:
- ca-certificates
Loading