Skip to content

Commit 1543553

Browse files
authored
Merge pull request #11 from kubewarden/fix-artifacthub
feat: Publish to artifacthub via artifacthub branch
2 parents 7ec89db + 1a12879 commit 1543553

5 files changed

Lines changed: 50 additions & 34 deletions

File tree

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
test:
1313
name: run tests and linters
14-
uses: kubewarden/github-actions/.github/workflows/reusable-test-policy-swift.yml@v2
14+
uses: kubewarden/github-actions/.github/workflows/reusable-test-policy-swift.yml@v3.1.0
1515

1616
release:
1717
needs: test
@@ -23,8 +23,6 @@ jobs:
2323
# Required by cosign keyless signing
2424
id-token: write
2525

26-
uses: kubewarden/github-actions/.github/workflows/reusable-release-policy-swift.yml@v2
26+
uses: kubewarden/github-actions/.github/workflows/reusable-release-policy-swift.yml@v3.1.0
2727
with:
28-
oci-target: # FIXME: use something like: ghcr.io/${{ github.repository_owner }}/policies/policy-name
29-
secrets:
30-
workflow-pat: ${{ secrets.WORKFLOW_PAT }}
28+
oci-target: ghcr.io/${{ github.repository_owner }}/policies/policy-name # FIXME
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ name: Continuous integration
33
jobs:
44
test:
55
name: run tests and linters
6-
uses: kubewarden/github-actions/.github/workflows/reusable-test-policy-swift.yml@v2
6+
uses: kubewarden/github-actions/.github/workflows/reusable-test-policy-swift.yml@v3.1.0

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
CONTAINER_RUNTIME ?= docker
22
CONTAINER_IMAGE := "ghcr.io/kubewarden/swift-wasm-runner:5.3-p1"
3-
VERSION := $(shell git describe --exact-match --tags $(git log -n1 --pretty='%h') | cut -c2-)
3+
# It's necessary to call cut because kwctl command does not handle version
4+
# starting with v.
5+
VERSION ?= $(shell git describe | cut -c2-)
46

57
build:
68
ifndef CONTAINER_RUNTIME
@@ -43,11 +45,14 @@ endif
4345
wasm-opt -Os .build/wasm32-unknown-wasi/release/Policy.wasm -o policy.wasm
4446

4547
artifacthub-pkg.yml: metadata.yml
48+
$(warning If you are updating the artifacthub-pkg.yml file for a release, \
49+
remember to set the VERSION variable with the proper value. \
50+
To use the latest tag, use the following command: \
51+
make VERSION=$$(git describe --tags --abbrev=0 | cut -c2-) annotated-policy.wasm)
4652
kwctl scaffold artifacthub \
47-
--metadata-path metadata.yml --version $(VERSION) \
48-
--questions-path questions-ui.yml > artifacthub-pkg.yml.tmp \
49-
&& mv artifacthub-pkg.yml.tmp artifacthub-pkg.yml \
50-
|| rm -f artifacthub-pkg.yml.tmp
53+
--metadata-path metadata.yml --version $(VERSION) \
54+
--output artifacthub-pkg.yml
55+
5156

5257
annotate: artifacthub-pkg.yml
5358
kwctl annotate -m metadata.yml -u README.md -o annotated-policy.wasm policy.wasm

artifacthub-pkg.yml

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,49 @@
1-
---
2-
###
3-
### Use `make artifacthub-pkg.yml` to auto-generate this file
4-
### See docs.kubewarden.io for publishing to ArtifactHub
5-
###
6-
version: 0.0.1
1+
# Kubewarden Artifacthub Package config
2+
#
3+
# Use this config to submit the policy to https://artifacthub.io.
4+
#
5+
# This config can be saved to its default location with:
6+
# kwctl scaffold artifacthub > artifacthub-pkg.yml
7+
version: 0.0.1-unreleased-3-g7dcff17
78
name: policy-name
89
displayName: Policy Name
9-
createdAt: '2022-07-19T16:39:10+02:00'
10-
description: DESCRIPTION OF YOUR POLICY
10+
createdAt: 2023-03-24T17:39:26.902596213Z
11+
description: Short description
1112
license: Apache-2.0
12-
homeURL: POLICY HOMEPAGE URL
13+
homeURL: https://github.com/yourorg/policy-name
1314
containersImages:
1415
- name: policy
15-
image: "<registry>/<policy-name>:0.0.1"
16-
install: |
17-
The policy can be obtained using [`kwctl`](https://github.com/kubewarden/kwctl/):
18-
19-
```console
20-
kwctl pull <registry>/<policy-name>:0.0.1
21-
```
16+
image: ghcr.io/yourorg/policies/policy-name:v0.0.1-unreleased-3-g7dcff17
2217
keywords:
23-
- this is freeform
18+
- pod
19+
- cool policy
20+
- kubewarden
2421
links:
2522
- name: policy
26-
url: https://github.com/yourorg/policy-name/releases/download/0.0.1/policy.wasm
23+
url: https://github.com/yourorg/policy-name/releases/download/v0.0.1-unreleased-3-g7dcff17/policy.wasm
2724
- name: source
28-
url: POLICY HOMEPAGE URL
25+
url: https://github.com/yourorg/policy-name
26+
install: |
27+
The policy can be obtained using [`kwctl`](https://github.com/kubewarden/kwctl):
28+
```console
29+
kwctl pull ghcr.io/yourorg/policies/policy-name:v0.0.1-unreleased-3-g7dcff17
30+
```
31+
maintainers:
32+
- name: Author name
33+
email: author-email@example.com
2934
provider:
3035
name: kubewarden
3136
recommendations:
3237
- url: https://artifacthub.io/packages/helm/kubewarden/kubewarden-controller
3338
annotations:
34-
kubewarden/resources: Pod # comma separated list
35-
kubewarden/mutation: false
36-
kubewarden/contextAware: false
39+
kubewarden/mutation: 'false'
40+
kubewarden/resources: Pod
41+
kubewarden/rules: |
42+
- apiGroups:
43+
- ''
44+
apiVersions:
45+
- v1
46+
resources:
47+
- pods
48+
operations:
49+
- CREATE

metadata.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ annotations:
1515
# kubewarden specific:
1616
io.kubewarden.policy.title: policy-name
1717
io.kubewarden.policy.description: Short description
18-
io.kubewarden.policy.author: policy-author
18+
io.kubewarden.policy.author: "Author name <author-email@example.com>"
1919
io.kubewarden.policy.url: https://github.com/yourorg/policy-name
2020
io.kubewarden.policy.source: https://github.com/yourorg/policy-name
2121
io.kubewarden.policy.license: Apache-2.0

0 commit comments

Comments
 (0)