Skip to content

Commit 5681e20

Browse files
committed
Initial version
1 parent bc4bff4 commit 5681e20

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

.github/workflows/test.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test build Snap
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
build-test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: snapcore/action-build@v1
16+
id: snapcraft
17+
required_status_checks:
18+
name: Required Build Test Status Check
19+
runs-on: ubuntu-latest
20+
needs:
21+
- build-test
22+
if: always() && !cancelled()
23+
timeout-minutes: 5
24+
steps:
25+
- run: |
26+
[ '${{ needs.build-test.result }}' = 'success' ] || (echo build-test failed && false)

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#snapcraft specifics
2+
parts
3+
stage
4+
prime
5+
*.snap
6+
.snapcraft
7+
__pycache__
8+
*.pyc
9+
10+
.bzr

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @canonical/is-charms

renovate.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:base"
5+
],
6+
"prBodyNotes": [
7+
"---",
8+
"### Pre-merge checks",
9+
"- [ ] The Release Notes do not describe any breaking changes.",
10+
],
11+
"regexManagers": [
12+
{
13+
"fileMatch": ["(^|/)snapcraft.yaml$"],
14+
"description": "Update Mas-cli",
15+
"matchStringsStrategy": "any",
16+
"matchStrings": [
17+
"source-tag: v(?<currentValue>.+)",
18+
"version: (?<currentValue>.+)"
19+
],
20+
"datasourceTemplate": "github-releases",
21+
"depNameTemplate": "element-hq/matrix-authentication-service",
22+
"versioningTemplate": "semver-coerced"
23+
}
24+
]
25+
}

snapcraft.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2024 Canonical Ltd.
2+
# See LICENSE file for licensing details.
3+
4+
name: mas-cli
5+
summary: MAS CLI Tool
6+
description: MAS CLI is a command-line tool for managing MAS policies.
7+
version: 0.14.1
8+
base: core22
9+
license: Apache-2.0
10+
confinement: strict
11+
architectures:
12+
- build-on: [amd64]
13+
build-for: [amd64]
14+
15+
parts:
16+
mas-cli:
17+
plugin: rust
18+
rust-channel: stable
19+
rust-cargo-parameters:
20+
- "--features dist"
21+
- "--no-default-features"
22+
source: https://github.com/element-hq/matrix-authentication-service
23+
source-type: git
24+
source-tag: v0.14.1
25+
build-snaps:
26+
- go/1.22/stable
27+
override-build: |
28+
# Build the open-policy-agent binary
29+
git clone --depth 1 --branch v0.70.0 https://github.com/open-policy-agent/opa.git
30+
(cd opa; make build; chmod +x opa_linux_amd64; mv opa_linux_amd64 /usr/local/bin/opa)
31+
# Build MAS policies
32+
(cd policies; make)
33+
# Install policy file
34+
mkdir -p $CRAFT_PART_INSTALL/mas/share
35+
cp policies/policy.wasm $CRAFT_PART_INSTALL/mas/share/policy.wasm
36+
craftctl default
37+
override-prime: |
38+
craftctl default
39+
cp $SNAPCRAFT_PART_BUILD/target/release/mas-cli $SNAPCRAFT_PRIME/
40+
41+
apps:
42+
mas-cli:
43+
command: mas-cli

0 commit comments

Comments
 (0)