Skip to content

Commit

Permalink
Merge branch 'master' into philippsauter/sc-79807/documentation-for-p…
Browse files Browse the repository at this point in the history
…ublic-package-repository
  • Loading branch information
sauterp authored Oct 26, 2023
2 parents 58c6b7a + 1ed21e9 commit 86a0258
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
id: get-version-tag
shell: bash

- run: echo "linux_amd64_checksum="$(grep -P 'exoscale-cli_[0-9]+\.[0-9]+\.[0-9]_linux_amd64.tar.gz' dist/exoscale-cli_*_checksums.txt | head -n 1 | cut -c1-64) >> $GITHUB_OUTPUT
- run: echo "linux_amd64_checksum="$(grep -P 'exoscale-cli_[0-9]+\.[0-9]+\.[0-9]+_linux_amd64.tar.gz' dist/exoscale-cli_*_checksums.txt | head -n 1 | cut -c1-64) >> $GITHUB_OUTPUT
id: get-linux-amd64-checksum
shell: bash

Expand Down
9 changes: 8 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,17 @@ scoops:
branch: master

publishers:
- name: rpms
env:
- AWS_ACCESS_KEY_ID={{ .Env.EXOSCALE_API_KEY }}
- AWS_SECRET_ACCESS_KEY={{ .Env.EXOSCALE_API_SECRET }}
ids:
- nfpms
cmd: ./go.mk/scripts/publish-rpm-artifact-to-sos.sh {{ .ArtifactPath }} exoscale-packages rpm/cli 10
- name: aptly
env:
- AWS_ACCESS_KEY_ID={{ .Env.EXOSCALE_API_KEY }}
- AWS_SECRET_ACCESS_KEY={{ .Env.EXOSCALE_API_SECRET }}
ids:
- nfpms
cmd: ./go.mk/scripts/publish-deb-artifact-to-sos.sh {{ .ArtifactPath }} exoscale-packages deb/cli 10
cmd: ./go.mk/scripts/publish-deb-artifact-to-sos.sh {{ .ArtifactPath }} exoscale-packages deb/cli 10 {{ .ProjectName }}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

## UNRELEASED

### Improvements

- README: document installation from AUR #557
- install-script: install rpms from SOS repo #556

## 1.74.4

### Improvements

- publish releases as rpm packages on SOS #555

## 1.74.3

Expand Down
10 changes: 5 additions & 5 deletions bucket/exoscale-cli.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"version": "1.74.3",
"version": "1.74.4",
"architecture": {
"64bit": {
"url": "https://github.com/exoscale/cli/releases/download/v1.74.3/exoscale-cli_1.74.3_windows_amd64.zip",
"url": "https://github.com/exoscale/cli/releases/download/v1.74.4/exoscale-cli_1.74.4_windows_amd64.zip",
"bin": [
"exo.exe"
],
"hash": "ea6be1607ff609f3bae0317088e575263ac510c90a359a724c4b27e00b283ddb"
"hash": "54bb76859285279ddcc40283275f2e8de240290a395c7c04fd1ad6dbf619be00"
},
"arm64": {
"url": "https://github.com/exoscale/cli/releases/download/v1.74.3/exoscale-cli_1.74.3_windows_arm64.zip",
"url": "https://github.com/exoscale/cli/releases/download/v1.74.4/exoscale-cli_1.74.4_windows_arm64.zip",
"bin": [
"exo.exe"
],
"hash": "b90713300412f3dd4df96fa1bbe5ad87d52d55e2ad11dcdc7d0b18365c8158d9"
"hash": "e9be237a71101eda73bd3e65cb0f9c522c594094eadb8b77dc7b8ca5ecf2eed6"
}
},
"homepage": "https://github.com/exoscale/cli",
Expand Down
2 changes: 1 addition & 1 deletion go.mk
65 changes: 46 additions & 19 deletions install-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,24 @@ PKGFILE="${PKGPREFIX}_${LATEST_VERSION}_${OSTYPE}_${CPUARCHITECTURE}.${FILEEXT}"
PKGSIGFILE=$PKGFILE.sig
PKGPATH=$TEMPDIR/$PKGFILE
PKGSIGPATH=$TEMPDIR/$PKGSIGFILE
$CURL "$GITHUB_DOWNLOAD_URL/${LATEST_TAG}/$PKGFILE" >$PKGPATH

# check the checksum
CHECKSUMSFILE="${PKGPREFIX}_${LATEST_VERSION}_checksums.txt"
CHECKSUMSPATH=$TEMPDIR/$CHECKSUMSFILE
$CURL "$GITHUB_DOWNLOAD_URL/${LATEST_TAG}/$CHECKSUMSFILE" >$CHECKSUMSPATH
download_pkg() {
$CURL "$GITHUB_DOWNLOAD_URL/${LATEST_TAG}/$PKGFILE" >$PKGPATH

COMPUTED_CHECKSUM=$(sha256sum "$PKGPATH" | cut -d " " -f 1)
EXPECTED_CHECKSUM=$(grep -m 1 $PKGFILE $CHECKSUMSPATH | cut -d " " -f 1)
CHECKSUMSFILE="${PKGPREFIX}_${LATEST_VERSION}_checksums.txt"
CHECKSUMSPATH=$TEMPDIR/$CHECKSUMSFILE
$CURL "$GITHUB_DOWNLOAD_URL/${LATEST_TAG}/$CHECKSUMSFILE" >$CHECKSUMSPATH

if [ "$COMPUTED_CHECKSUM" != "$EXPECTED_CHECKSUM" ]; then
echo "Error: Checksum of $PKGFILE does not match the expected checksum"
echo $COMPUTED_CHECKSUM
echo $EXPECTED_CHECKSUM
exit 1
fi
COMPUTED_CHECKSUM=$(sha256sum "$PKGPATH" | cut -d " " -f 1)
EXPECTED_CHECKSUM=$(grep -m 1 $PKGFILE $CHECKSUMSPATH | cut -d " " -f 1)

if [ "$COMPUTED_CHECKSUM" != "$EXPECTED_CHECKSUM" ]; then
echo "Error: Checksum of $PKGFILE does not match the expected checksum"
echo $COMPUTED_CHECKSUM
echo $EXPECTED_CHECKSUM
exit 1
fi
}

TOOLING_KEY_NAME="Exoscale Tooling <[email protected]>"
TOOLING_KEY_FINGERPRINT="7100E8BFD6199CE0374CB7F003686F8CDE378D41"
Expand All @@ -171,9 +173,9 @@ verify_pkg() {
fi
}

if command -v gpg >/dev/null 2>&1; then
if command -v gpg >/dev/null 2>&1 && [ "$PACKAGETYPE" != "yum" ]; then
if ! gpg --list-keys | grep -q $TOOLING_KEY_FINGERPRINT; then
gpg --recv-keys "$TOOLING_KEY_FINGERPRINT"
gpg --keyserver keys.openpgp.org --recv-keys "$TOOLING_KEY_FINGERPRINT"
fi

GPG_AVAILABLE=yes
Expand All @@ -184,6 +186,32 @@ else
fi
fi

install_rpm_pkg() {
repofile=/etc/yum.repos.d/exoscale-cli.repo
cat <<EOF | $SUDO tee $repofile
[exoscale-cli-repo]
name=exoscale-cli-repo
baseurl=https://sos-ch-gva-2.exo.io/exoscale-packages/rpm/cli
enabled=1
repo_gpgcheck=1
gpgcheck=0
gpgkey=https://keys.openpgp.org/vks/v1/by-fingerprint/7100E8BFD6199CE0374CB7F003686F8CDE378D41
EOF

if [ "$PACKAGETYPE" = "yum" ]; then
REPOFLAG=""
else
REPOFLAG="--repo=exoscale-cli-repo"
fi
if $PACKAGETYPE list installed exoscale-cli >/dev/null 2>&1; then
$SUDO $PACKAGETYPE makecache -y $REPOFLAG
$SUDO $PACKAGETYPE $REPOFLAG upgrade -y exoscale-cli
else
$SUDO $PACKAGETYPE makecache -y $REPOFLAG
$SUDO $PACKAGETYPE $REPOFLAG install -y exoscale-cli
fi
}

echo "Installing exo CLI, using $PACKAGETYPE"
case "$PACKAGETYPE" in
apt)
Expand All @@ -194,15 +222,14 @@ case "$PACKAGETYPE" in
$SUDO apt-get install -y exoscale-cli
;;
dpkg)
download_pkg
verify_pkg
$SUDO dpkg -i $PKGPATH
;;
yum)
verify_pkg
$SUDO yum install -y $PKGPATH
install_rpm_pkg
;;
dnf)
verify_pkg
$SUDO dnf install -y $PKGPATH
install_rpm_pkg
;;
esac

0 comments on commit 86a0258

Please sign in to comment.