summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authormapk0y2023-06-30 15:37:01 +0900
committermapk0y2023-06-30 15:37:01 +0900
commitc7906028f30d72212782a5d947e78efa940043df (patch)
tree48ff4719d125eb3bca0e7c8a4b8023c747384f20
parentb8fbbeb6077d4f5a85a4b4bf22ad5afeec50f285 (diff)
downloadaur-c7906028f30d72212782a5d947e78efa940043df.tar.gz
Update to v3.0.0
- Update version - Update description - Add test script and Dockerfile - Add Makefile as a task runner
-rw-r--r--.SRCINFO10
-rw-r--r--Dockerfile7
-rw-r--r--Makefile52
-rw-r--r--PKGBUILD27
-rwxr-xr-xtest.sh28
5 files changed, 112 insertions, 12 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 99fc560427bc..69616f424078 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,13 +1,13 @@
pkgbase = cfn-guard
- pkgdesc = A set of tools to check AWS CloudFormation templates for policy compliance using a simple, policy-as-code, declarative syntax
- pkgver = 2.1.3
- pkgrel = 2
+ pkgdesc = Guard offers a policy-as-code domain-specific language (DSL) to write rules and validate JSON- and YAML-formatted data such as CloudFormation Templates, K8s configurations, and Terraform JSON plans/configurations against those rules.
+ pkgver = 3.0.0
+ pkgrel = 1
url = https://github.com/aws-cloudformation/cloudformation-guard
arch = x86_64
license = Apache
depends = gcc-libs
conflicts = cfn-guard-git
- source = https://github.com/aws-cloudformation/cloudformation-guard/releases/download/2.1.3/cfn-guard-v2-ubuntu-latest.tar.gz
- sha256sums = 0b05f2e1695fcb7740cd74cf030bd56e32bd1fbcfc69cb92fb290b2475a97d61
+ source = https://github.com/aws-cloudformation/cloudformation-guard/releases/download/3.0.0/cfn-guard-v3-ubuntu-latest.tar.gz
+ sha256sums = 6aa93074ce470782c388ffbcf391981ea3c2f806c41e4dce1a63c9415f7e9c2b
pkgname = cfn-guard
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000000..569af1cb5cea
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,7 @@
+FROM archlinux:base
+# ref. https://github.com/KSXGitHub/github-actions-deploy-aur
+
+RUN pacman -Syu --noconfirm
+RUN pacman -S --noconfirm --needed \
+ pacman-contrib
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000000..cbc2f5ad4e58
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,52 @@
+# vi: set ft=make ts=2 sw=2 sts=0 noet:
+
+SHELL := /bin/bash
+
+MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+.PHONY: default
+default: help
+
+# http://postd.cc/auto-documented-makefile/
+.PHONY: help help-common
+help: help-common
+
+help-common:
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}'
+
+
+.PHONY: renew install update package clean update_tag test
+renew: update_tag install ## get newer version and renew package, install that
+
+install: ## install package
+ makepkg -si
+
+update_checksum: ## upgrade pkg checksum
+ @# makepkg -g は更新してくれるわけではない
+ @# https://wiki.archlinux.org/title/PKGBUILD#Integrity
+ updpkgsums
+
+package: update_checksum ## packaging for manual operation
+ makepkg -s
+ mksrcinfo
+
+package_auto: update_tag ## Auto packaging
+ makepkg -s
+ mksrcinfo
+
+clean: ## remove tar.gz
+ rm -vf *.tar.xz *.tar.gz
+
+update_tag: LATEST := "$(shell curl -sL https://api.github.com/repos/aws-cloudformation/cloudformation-guard/releases/latest | jq -r '.tag_name|ltrimstr("v")')"
+update_tag: ## get and update newest version in PKGBUILD
+ source ./PKGBUILD && \
+ if [[ $${pkgver} != $(LATEST) ]]; then \
+ sed -i -e 's/^pkgver=.*$$/pkgver=$(LATEST)/' ./PKGBUILD && \
+ updpkgsums && \
+ git diff ./PKGBUILD; \
+ fi
+
+test: ## test (needs make package)
+ docker build -t arch:arch-package-test -f $(MAKEFILE_DIR)/Dockerfile $(MAKEFILE_DIR) && \
+ docker run -it --rm -v $(MAKEFILE_DIR):/work -w /work arch:arch-package-test ./test.sh
+
diff --git a/PKGBUILD b/PKGBUILD
index 6ef92cf6dab0..4965ab751a99 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,18 +1,31 @@
# Maintainer: Kazuya Yokogawa <mapk0y at gmail.com>
pkgname='cfn-guard'
-pkgver=2.1.3
-pkgrel=2
-pkgdesc='A set of tools to check AWS CloudFormation templates for policy compliance using a simple, policy-as-code, declarative syntax'
+pkgver=3.0.0
+pkgrel=1
+pkgdesc='Guard offers a policy-as-code domain-specific language (DSL) to write rules and validate JSON- and YAML-formatted data such as CloudFormation Templates, K8s configurations, and Terraform JSON plans/configurations against those rules.'
url='https://github.com/aws-cloudformation/cloudformation-guard'
license=('Apache')
arch=('x86_64')
depends=('gcc-libs')
conflicts=("cfn-guard-git")
-source=("${url}/releases/download/${pkgver}/${pkgname}-v2-ubuntu-latest.tar.gz")
-sha256sums=('0b05f2e1695fcb7740cd74cf030bd56e32bd1fbcfc69cb92fb290b2475a97d61')
+source=("${url}/releases/download/${pkgver}/${pkgname}-v3-ubuntu-latest.tar.gz")
+sha256sums=('6aa93074ce470782c388ffbcf391981ea3c2f806c41e4dce1a63c9415f7e9c2b')
+
+build() {
+ ${srcdir}/cfn-guard-v3-ubuntu-latest/cfn-guard completions --shell='zsh' > _cfn-guard.zsh
+ ${srcdir}/cfn-guard-v3-ubuntu-latest/cfn-guard completions --shell='bash' > cfn-guard.bash
+ ${srcdir}/cfn-guard-v3-ubuntu-latest/cfn-guard completions --shell='fish' > cfn-guard.fish
+}
package() {
- install -Dm755 ${srcdir}/cfn-guard-v2-ubuntu-latest/cfn-guard "$pkgdir/usr/bin/cfn-guard"
- install -Dm644 ${srcdir}/cfn-guard-v2-ubuntu-latest/README.md "$pkgdir/usr/share/doc/${pkgname}/README.md"
+ install -Dm755 ${srcdir}/cfn-guard-v3-ubuntu-latest/cfn-guard "$pkgdir/usr/bin/cfn-guard"
+ install -Dm644 ${srcdir}/cfn-guard-v3-ubuntu-latest/README.md "$pkgdir/usr/share/doc/${pkgname}/README.md"
+ install -Dm644 ${srcdir}/cfn-guard.zsh "$pkgdir/usr/share/zsh/site-functions/_cfn-guard"
+ install -Dm644 ${srcdir}/cfn-guard.bash "$pkgdir/usr/share/bash-completion/completions/cfn-guard"
+ install -Dm644 ${srcdir}/cfn-guard.fish "$pkgdir/usr/share/fish/completions/cfn-guard.fish"
+}
+
+check() {
+ ${srcdir}/cfn-guard-v3-ubuntu-latest/cfn-guard --version
}
diff --git a/test.sh b/test.sh
new file mode 100755
index 000000000000..64ea7823762f
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -eu
+
+source ./PKGBUILD
+
+echo "## install start"
+pacman -U --noconfirm ${pkgname}-${pkgver}-${pkgrel}-x86_64.pkg.tar.xz
+
+echo "## install complete"
+
+echo "## check installed files"
+
+cfn-guard --help
+
+echo "## check bash completion"
+ls -l /usr/share/bash-completion/completions/cfn-guard
+head /usr/share/bash-completion/completions/cfn-guard
+
+echo "## check zsh completion"
+ls -l /usr/share/zsh/site-functions/_cfn-guard
+head /usr/share/zsh/site-functions/_cfn-guard
+
+echo "## check fish completion"
+ls -l /usr/share/fish/completions/cfn-guard.fish
+head /usr/share/fish/completions/cfn-guard.fish
+
+echo "test OK"