diff --git a/.github/aur/flux-bin/.SRCINFO.template b/.github/aur/flux-bin/.SRCINFO.template new file mode 100644 index 00000000..7f20ef92 --- /dev/null +++ b/.github/aur/flux-bin/.SRCINFO.template @@ -0,0 +1,17 @@ +pkgbase = flux-bin + pkgdesc = Open and extensible continuous delivery solution for Kubernetes + pkgver = ${PKGVER} + pkgrel = ${PKGREL} + url = https://fluxcd.io/ + arch = x86_64 + arch = armv6h + arch = armv7h + arch = aarch64 + license = APACHE + optdepends = kubectl + source_x86_64 = flux-bin-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v1/flux_${PKGVER}_linux_amd64.tar.gz + source_armv6h = flux-bin-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v1/flux_${PKGVER}_linux_arm.tar.gz + source_armv7h = flux-bin-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v1/flux_${PKGVER}_linux_arm.tar.gz + source_aarch64 = flux-bin-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/releases/download/v1/flux_${PKGVER}_linux_arm64.tar.gz + +pkgname = flux-bin diff --git a/.github/aur/flux-bin/.gitignore b/.github/aur/flux-bin/.gitignore new file mode 100644 index 00000000..5a6ed48b --- /dev/null +++ b/.github/aur/flux-bin/.gitignore @@ -0,0 +1 @@ +.pkg diff --git a/.github/aur/flux-bin/PKGBUILD.template b/.github/aur/flux-bin/PKGBUILD.template new file mode 100644 index 00000000..6bb09e17 --- /dev/null +++ b/.github/aur/flux-bin/PKGBUILD.template @@ -0,0 +1,39 @@ +# Maintainer: Aurel Canciu +# Maintainer: Hidde Beydals + +pkgname=flux-bin +pkgver=${PKGVER} +pkgrel=${PKGREL} +pkgdesc="Open and extensible continuous delivery solution for Kubernetes" +url="https://fluxcd.io/" +arch=("x86_64" "armv6h" "armv7h" "aarch64") +license=("APACHE") +optdepends=("kubectl") +source_x86_64=( + "$pkgname-$pkgver.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_amd64.tar.gz" +) +source_armv6h=( + "$pkgname-$pkgver.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_arm.tar.gz" +) +source_armv7h=( + "$pkgname-$pkgver.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_arm.tar.gz" +) +source_aarch64=( + "$pkgname-$pkgver.tar.gz::https://github.com/fluxcd/flux2/releases/download/v${pkgver}/flux_${pkgver}_linux_arm64.tar.gz" +) +sha256sums_x86_64=( + ${SHA256SUM_AMD64} +) +sha256sums_armv6h=( + ${SHA256SUM_ARM} +) +sha256sums_armv7h=( + ${SHA256SUM_ARM} +) +sha256sums_aarch64=( + ${SHA256SUM_ARM64} +) + +package() { + install -Dm755 flux "$pkgdir/usr/bin/flux" +} diff --git a/.github/aur/flux-bin/publish.sh b/.github/aur/flux-bin/publish.sh new file mode 100755 index 00000000..8f661530 --- /dev/null +++ b/.github/aur/flux-bin/publish.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +set -e + +WD=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd) +PKGNAME=$(basename $WD) +ROOT=${WD%/.github/aur/$PKGNAME} + +export VERSION=$1 +echo "Publishing to AUR as version ${VERSION}" + +cd $WD + +export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + +rm -rf .pkg +git clone aur@aur.archlinux.org:$PKGNAME .pkg 2>&1 + +CURRENT_PKGVER=$(cat .pkg/.SRCINFO | grep pkgver | awk '{ print $3 }') +CURRENT_PKGREL=$(cat .pkg/.SRCINFO | grep pkgrel | awk '{ print $3 }') + +export PKGVER=${VERSION/-/} + +if [[ "${CURRENT_PKGVER}" == "${PKGVER}" ]]; then + export PKGREL=$((CURRENT_PKGREL+1)) +else + export PKGREL=1 +fi + +export SHA256SUM_ARM=$(sha256sum ${ROOT}/dist/flux_${PKGVER}_linux_arm.tar.gz | awk '{ print $1 }') +export SHA256SUM_ARM64=$(sha256sum ${ROOT}/dist/flux_${PKGVER}_linux_arm64.tar.gz | awk '{ print $1 }') +export SHA256SUM_AMD64=$(sha256sum ${ROOT}/dist/flux_0.4.2_linux_amd64.tar.gz | awk '{ print $1 }') + +envsubst '$PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < .SRCINFO.template > .pkg/.SRCINFO +envsubst '$PKGVER $PKGREL $SHA256SUM_AMD64 $SHA256SUM_ARM $SHA256SUM_ARM64' < PKGBUILD.template > .pkg/PKGBUILD + +cd .pkg +git config user.name "fluxcdbot" +git config user.email "fluxcdbot@users.noreply.github.com" +git add -A +if [ -z "$(git status --porcelain)" ]; then + echo "No changes." +else + git commit -m "Updated to version v${PKGVER} release ${PKGREL}" + git push origin master +fi diff --git a/.github/aur/flux-go/.SRCINFO.template b/.github/aur/flux-go/.SRCINFO.template new file mode 100644 index 00000000..ba0cfd77 --- /dev/null +++ b/.github/aur/flux-go/.SRCINFO.template @@ -0,0 +1,19 @@ +pkgbase = flux-go + pkgdesc = Open and extensible continuous delivery solution for Kubernetes + pkgver = ${PKGVER} + pkgrel = ${PKGREL} + url = https://fluxcd.io/ + arch = x86_64 + arch = armv6h + arch = armv7h + arch = aarch64 + license = APACHE + makedepends = go + depends = glibc + optdepends = kubectl + provides = flux-bin + conflicts = flux-bin + replaces = flux-cli + source = flux-go-${PKGVER}.tar.gz::https://github.com/fluxcd/flux2/archive/v${PKGVER}.tar.gz + +pkgname = flux-go diff --git a/.github/aur/flux-go/.gitignore b/.github/aur/flux-go/.gitignore new file mode 100644 index 00000000..5a6ed48b --- /dev/null +++ b/.github/aur/flux-go/.gitignore @@ -0,0 +1 @@ +.pkg diff --git a/.github/aur/flux-go/PKGBUILD.template b/.github/aur/flux-go/PKGBUILD.template new file mode 100644 index 00000000..c5747339 --- /dev/null +++ b/.github/aur/flux-go/PKGBUILD.template @@ -0,0 +1,43 @@ +# Maintainer: Aurel Canciu +# Maintainer: Hidde Beydals + +pkgname=flux-go +pkgver=${PKGVER} +pkgrel=${PKGREL} +pkgdesc="Open and extensible continuous delivery solution for Kubernetes" +url="https://fluxcd.io/" +arch=("x86_64" "armv6h" "armv7h" "aarch64") +license=("APACHE") +provides=("flux-bin") +conflicts=("flux-bin") +replaces=("flux-cli") +depends=("glibc") +makedepends=("go") +optdepends=("kubectl") +source=( + "$pkgname-$pkgver.tar.gz::https://github.com/fluxcd/flux2/archive/v$pkgver.tar.gz" +) +sha256sums=( + ${SHA256SUM} +) + +build() { + cd "flux2-$pkgver" + export CGO_LDFLAGS="$LDFLAGS" + export CGO_CFLAGS="$CFLAGS" + export CGO_CXXFLAGS="$CXXFLAGS" + export CGO_CPPFLAGS="$CPPFLAGS" + export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" + go build -ldflags "-X main.VERSION=$pkgver" -o flux-bin ./cmd/flux +} + +check() { + cd "flux2-$pkgver" + make test +} + +package() { + cd "flux2-$pkgver" + install -Dm755 flux-bin "$pkgdir/usr/bin/flux" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} diff --git a/.github/aur/flux-go/publish.sh b/.github/aur/flux-go/publish.sh new file mode 100755 index 00000000..ed84332c --- /dev/null +++ b/.github/aur/flux-go/publish.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -e + +WD=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd) +PKGNAME=$(basename $WD) +ROOT=${WD%/.github/aur/$PKGNAME} + +export VERSION=$1 +echo "Publishing to AUR as version ${VERSION}" + +cd $WD + +export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + +rm -rf .pkg +git clone aur@aur.archlinux.org:$PKGNAME .pkg 2>&1 + +CURRENT_PKGVER=$(cat .pkg/.SRCINFO | grep pkgver | awk '{ print $3 }') +CURRENT_PKGREL=$(cat .pkg/.SRCINFO | grep pkgrel | awk '{ print $3 }') + +export PKGVER=${VERSION/-/} + +if [[ "${CURRENT_PKGVER}" == "${PKGVER}" ]]; then + export PKGREL=$((CURRENT_PKGREL+1)) +else + export PKGREL=1 +fi + +export SHA256SUM=$(curl -sL https://github.com/fluxcd/flux2/archive/v$PKGVER.tar.gz | sha256sum | awk '{ print $1 }') + +envsubst '$PKGVER $PKGREL $SHA256SUM' < .SRCINFO.template > .pkg/.SRCINFO +envsubst '$PKGVER $PKGREL $SHA256SUM' < PKGBUILD.template > .pkg/PKGBUILD + +cd .pkg +git config user.name "fluxcdbot" +git config user.email "fluxcdbot@users.noreply.github.com" +git add -A +if [ -z "$(git status --porcelain)" ]; then + echo "No changes." +else + git commit -m "Updated to version v${PKGVER} release ${PKGREL}" + git push origin master +fi diff --git a/.github/aur/flux-scm/.SRCINFO.template b/.github/aur/flux-scm/.SRCINFO.template new file mode 100644 index 00000000..e7f3288a --- /dev/null +++ b/.github/aur/flux-scm/.SRCINFO.template @@ -0,0 +1,19 @@ +pkgbase = flux-scm + pkgdesc = Open and extensible continuous delivery solution for Kubernetes + pkgver = ${PKGVER} + pkgrel = ${PKGREL} + url = https://fluxcd.io/ + arch = x86_64 + arch = armv6h + arch = armv7h + arch = aarch64 + license = APACHE + makedepends = go + depends = glibc + optdepends = kubectl + provides = flux-bin + conflicts = flux-bin + source = git+https://github.com/fluxcd/flux2.git + md5sums = SKIP + +pkgname = flux-scm diff --git a/.github/aur/flux-scm/.gitignore b/.github/aur/flux-scm/.gitignore new file mode 100644 index 00000000..5a6ed48b --- /dev/null +++ b/.github/aur/flux-scm/.gitignore @@ -0,0 +1 @@ +.pkg diff --git a/.github/aur/flux-scm/PKGBUILD.template b/.github/aur/flux-scm/PKGBUILD.template new file mode 100644 index 00000000..09c0537b --- /dev/null +++ b/.github/aur/flux-scm/PKGBUILD.template @@ -0,0 +1,45 @@ +# Maintainer: Aurel Canciu +# Maintainer: Hidde Beydals + +pkgname=flux-scm +pkgver=${PKGVER} +pkgrel=${PKGREL} +pkgdesc="Open and extensible continuous delivery solution for Kubernetes" +url="https://fluxcd.io/" +arch=("x86_64" "armv6h" "armv7h" "aarch64") +license=("APACHE") +provides=("flux-bin") +conflicts=("flux-bin") +depends=("glibc") +makedepends=("go") +optdepends=("kubectl") +source=( + "git+https://github.com/fluxcd/flux2.git" +) +md5sums=('SKIP') + +pkgver() { + cd "flux2" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +build() { + cd "flux2" + export CGO_LDFLAGS="$LDFLAGS" + export CGO_CFLAGS="$CFLAGS" + export CGO_CXXFLAGS="$CXXFLAGS" + export CGO_CPPFLAGS="$CPPFLAGS" + export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" + go build -ldflags "-X main.VERSION=$pkgver" -o flux-bin ./cmd/flux +} + +check() { + cd "flux2" + make test +} + +package() { + cd "flux2" + install -Dm755 flux-bin "$pkgdir/usr/bin/flux" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} diff --git a/.github/aur/flux-scm/publish.sh b/.github/aur/flux-scm/publish.sh new file mode 100755 index 00000000..e599e71f --- /dev/null +++ b/.github/aur/flux-scm/publish.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +set -e + +WD=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd) +PKGNAME=$(basename $WD) +ROOT=${WD%/.github/aur/$PKGNAME} + +export VERSION=$1 +echo "Publishing to AUR as version ${VERSION}" + +cd $WD + +export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + +rm -rf .pkg +git clone aur@aur.archlinux.org:$PKGNAME .pkg 2>&1 + +CURRENT_PKGVER=$(cat .pkg/.SRCINFO | grep pkgver | awk '{ print $3 }') +CURRENT_PKGREL=$(cat .pkg/.SRCINFO | grep pkgrel | awk '{ print $3 }') + +export PKGVER=${VERSION/-/} + +if [[ "${CURRENT_PKGVER}" == "${PKGVER}" ]]; then + export PKGREL=$((CURRENT_PKGREL+1)) +else + export PKGREL=1 +fi + +envsubst '$PKGVER $PKGREL' < .SRCINFO.template > .pkg/.SRCINFO +envsubst '$PKGVER $PKGREL' < PKGBUILD.template > .pkg/PKGBUILD + +cd .pkg +git config user.name "fluxcdbot" +git config user.email "fluxcdbot@users.noreply.github.com" +git add -A +if [ -z "$(git status --porcelain)" ]; then + echo "No changes." +else + git commit -m "Updated to version v${PKGVER} release ${PKGREL}" + git push origin master +fi diff --git a/.goreleaser.yml b/.goreleaser.yml index c72e9af0..1df84b11 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -50,3 +50,21 @@ brews: type: optional test: | system "#{bin}/flux --version" +publishers: + - name: aur-pkg-bin + ids: + - nix + cmd: | + eval $(ssh-agent -s) + ssh-add <(echo "{{ .Env.AUR_BOT_SSH_PRIVATE_KEY }}") + .github/aur/flux-bin/publish.sh {{ .Version }} + - name: aur-pkg-scm + cmd: | + eval $(ssh-agent -s) + ssh-add <(echo "{{ .Env.AUR_BOT_SSH_PRIVATE_KEY }}") + .github/aur/flux-scm/publish.sh {{ .Version }} + - name: aur-pkg-go + cmd: | + eval $(ssh-agent -s) + ssh-add <(echo "{{ .Env.AUR_BOT_SSH_PRIVATE_KEY }}") + .github/aur/flux-go/publish.sh {{ .Version }} diff --git a/README.md b/README.md index 32120e73..6f445013 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,16 @@ curl -s https://toolkit.fluxcd.io/install.sh | sudo bash . <(flux completion bash) ``` +Arch Linux (AUR) packages: + +There are three packages published in AUR: +- [flux-bin](https://aur.archlinux.org/packages/flux-bin): install the latest + stable version using a pre-build binary (recommended) +- [flux-go](https://aur.archlinux.org/packages/flux-go): build the latest + stable version from source code +- [flux-scm](https://aur.archlinux.org/packages/flux-scm): build the latest + (unstable) version from source code from our git `main` branch + Binaries for macOS, Windows and Linux AMD64/ARM are available to download on the [release page](https://github.com/fluxcd/flux2/releases). diff --git a/docs/get-started/index.md b/docs/get-started/index.md index 15a165e7..ed43c342 100644 --- a/docs/get-started/index.md +++ b/docs/get-started/index.md @@ -34,6 +34,15 @@ curl -s https://toolkit.fluxcd.io/install.sh | sudo bash The install script downloads the flux binary to `/usr/local/bin`. +If using Arch Linux, there are three packages published in AUR you can use to +install `flux`: +- [flux-bin](https://aur.archlinux.org/packages/flux-bin): install the latest + stable version using a pre-build binary (recommended) +- [flux-go](https://aur.archlinux.org/packages/flux-go): build the latest + stable version from source code +- [flux-scm](https://aur.archlinux.org/packages/flux-scm): build the latest + (unstable) version from source code from our git `main` branch + Binaries for **macOS**, **Windows** and **Linux** AMD64/ARM are available for download on the [release page](https://github.com/fluxcd/flux2/releases).