forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upbound: 0.34.0 -> 0.35.3 (NixOS#356864)
- Loading branch information
Showing
5 changed files
with
267 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
upbound, | ||
}: | ||
upbound.override { | ||
version-channel = "main"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,81 @@ | ||
{ lib, buildGoModule, fetchFromGitHub }: | ||
{ | ||
lib, | ||
fetchurl, | ||
installShellFiles, | ||
versionCheckHook, | ||
stdenvNoCC, | ||
version-channel ? "stable", | ||
}: | ||
let | ||
inherit (stdenvNoCC.hostPlatform) system; | ||
sources = | ||
if "${version-channel}" == "main" then import ./sources-main.nix else import ./sources-stable.nix; | ||
arch = sources.archMap.${system}; | ||
|
||
buildGoModule rec { | ||
pname = "upbound"; | ||
version = "0.34.0"; | ||
in | ||
stdenvNoCC.mkDerivation { | ||
pname = if "${version-channel}" == "main" then "upbound-main" else "upbound"; | ||
version = sources.version; | ||
srcs = [ | ||
(fetchurl { | ||
url = sources.fetchurlAttrSet.${system}.docker-credential-up.url; | ||
sha256 = sources.fetchurlAttrSet.${system}.docker-credential-up.hash; | ||
}) | ||
|
||
src = fetchFromGitHub { | ||
owner = pname; | ||
repo = "up"; | ||
rev = "v${version}"; | ||
hash = "sha256-npWCGR0/iXAF7efreWhpwqboXJ24lqk5TPaB7glwEFI="; | ||
}; | ||
(fetchurl { | ||
url = sources.fetchurlAttrSet.${system}.up.url; | ||
sha256 = sources.fetchurlAttrSet.${system}.up.hash; | ||
}) | ||
]; | ||
|
||
sourceRoot = "."; | ||
|
||
nativeBuildInputs = [ installShellFiles ]; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/bin | ||
cp ./${arch}/up $out/bin/up | ||
chmod +x $out/bin/up | ||
vendorHash = "sha256-f/RPyjrC5FsOjC5wnBtqEbLeVX7VeiVYFpRXcQ2lTc4="; | ||
cp ./${arch}/docker-credential-up $out/bin/docker-credential-up | ||
chmod +x $out/bin/docker-credential-up | ||
subPackages = [ "cmd/docker-credential-up" "cmd/up" ]; | ||
runHook postInstall | ||
''; | ||
|
||
ldflags = [ | ||
"-s" | ||
"-w" | ||
"-X github.com/upbound/up/internal/version.version=v${version}" | ||
postInstall = '' | ||
installShellCompletion --bash --name up <(echo complete -C up up) | ||
''; | ||
|
||
versionCheckProgramArg = "version"; | ||
|
||
nativeInstallCheckInputs = [ | ||
versionCheckHook | ||
]; | ||
|
||
meta = with lib; { | ||
description = | ||
"CLI for interacting with Upbound Cloud, Upbound Enterprise, and Universal Crossplane (UXP)"; | ||
doCheck = false; | ||
|
||
passthru.updateScript = [ | ||
./update.sh | ||
"${version-channel}" | ||
]; | ||
|
||
passthru.tests = { | ||
versionCheck = versionCheckHook; | ||
}; | ||
|
||
meta = { | ||
description = "CLI for interacting with Upbound Cloud, Upbound Enterprise, and Universal Crossplane (UXP)"; | ||
homepage = "https://upbound.io"; | ||
license = licenses.asl20; | ||
maintainers = with maintainers; [ lucperkins ]; | ||
license = lib.licenses.unfree; | ||
maintainers = with lib.maintainers; [ | ||
lucperkins | ||
jljox | ||
]; | ||
mainProgram = "up"; | ||
platforms = sources.platformList; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Generated by "update.sh main" - do not update manually! | ||
{ | ||
version = "0.37.0-0.rc.0.38.g797e121"; | ||
|
||
platformList = [ | ||
"aarch64-linux" | ||
"x86_64-linux" | ||
"x86_64-darwin" | ||
"aarch64-darwin" | ||
]; | ||
|
||
archMap = { | ||
aarch64-linux = "linux_arm64"; | ||
x86_64-linux = "linux_amd64"; | ||
x86_64-darwin = "darwin_amd64"; | ||
aarch64-darwin = "darwin_arm64"; | ||
}; | ||
|
||
fetchurlAttrSet = { | ||
|
||
aarch64-linux.docker-credential-up = { | ||
hash = "sha256-nZXniTuLzmV7tK/Pd4BjUzqYYH2OmQKC4yoCHOhZ3C8="; | ||
url = "https://cli.upbound.io/main/v0.37.0-0.rc.0.38.g797e121/bundle/docker-credential-up/linux_arm64.tar.gz"; | ||
}; | ||
x86_64-linux.docker-credential-up = { | ||
hash = "sha256-LILaT+vn2CdKzNWxYOeda+Zid9V11I94+vwDGkGwxuQ="; | ||
url = "https://cli.upbound.io/main/v0.37.0-0.rc.0.38.g797e121/bundle/docker-credential-up/linux_amd64.tar.gz"; | ||
}; | ||
x86_64-darwin.docker-credential-up = { | ||
hash = "sha256-7eUWveGIbimxbwOGtA6qrU7F8p8EpOCTHXN4vj74qqA="; | ||
url = "https://cli.upbound.io/main/v0.37.0-0.rc.0.38.g797e121/bundle/docker-credential-up/darwin_amd64.tar.gz"; | ||
}; | ||
aarch64-darwin.docker-credential-up = { | ||
hash = "sha256-XTgSZjbHXyt1BXNeaHXqdi4gs8eeD/7rE657oAeQKv4="; | ||
url = "https://cli.upbound.io/main/v0.37.0-0.rc.0.38.g797e121/bundle/docker-credential-up/darwin_arm64.tar.gz"; | ||
}; | ||
aarch64-linux.up = { | ||
hash = "sha256-cNk4uaXcdH3EucwGnGXGsPbmKGGO+ig3xfJ+fAcwEbo="; | ||
url = "https://cli.upbound.io/main/v0.37.0-0.rc.0.38.g797e121/bundle/up/linux_arm64.tar.gz"; | ||
}; | ||
x86_64-linux.up = { | ||
hash = "sha256-3h+Jtl84UdWvs2cbrDsbtqlCCpvvYjzXZLmzDY/9aXE="; | ||
url = "https://cli.upbound.io/main/v0.37.0-0.rc.0.38.g797e121/bundle/up/linux_amd64.tar.gz"; | ||
}; | ||
x86_64-darwin.up = { | ||
hash = "sha256-WzngxshyHnR1H7Rhkbw/wkN1i3TWyV8CcBTwLNVggdU="; | ||
url = "https://cli.upbound.io/main/v0.37.0-0.rc.0.38.g797e121/bundle/up/darwin_amd64.tar.gz"; | ||
}; | ||
aarch64-darwin.up = { | ||
hash = "sha256-KLcxE4847DE6e0AznjlNZnS6GNhT1JJaCnYDecTZ6EQ="; | ||
url = "https://cli.upbound.io/main/v0.37.0-0.rc.0.38.g797e121/bundle/up/darwin_arm64.tar.gz"; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Generated by "update.sh stable" - do not update manually! | ||
{ | ||
version = "0.36.1"; | ||
|
||
platformList = [ | ||
"aarch64-linux" | ||
"x86_64-linux" | ||
"x86_64-darwin" | ||
"aarch64-darwin" | ||
]; | ||
|
||
archMap = { | ||
aarch64-linux = "linux_arm64"; | ||
x86_64-linux = "linux_amd64"; | ||
x86_64-darwin = "darwin_amd64"; | ||
aarch64-darwin = "darwin_arm64"; | ||
}; | ||
|
||
fetchurlAttrSet = { | ||
|
||
aarch64-linux.docker-credential-up = { | ||
hash = "sha256-BnEQWK1Y4rCDEk5BgkUIeF0oK6C77AQZh6KWhS+MfqM="; | ||
url = "https://cli.upbound.io/stable/v0.36.1/bundle/docker-credential-up/linux_arm64.tar.gz"; | ||
}; | ||
x86_64-linux.docker-credential-up = { | ||
hash = "sha256-4A0Di92G/vi9NR/pH20E8aaSn/jYhduQbYH6aLL2R3E="; | ||
url = "https://cli.upbound.io/stable/v0.36.1/bundle/docker-credential-up/linux_amd64.tar.gz"; | ||
}; | ||
x86_64-darwin.docker-credential-up = { | ||
hash = "sha256-/i4VsDUk0B+htRv0UCjCLT1ByewO8UNHOMbbxqIfvvE="; | ||
url = "https://cli.upbound.io/stable/v0.36.1/bundle/docker-credential-up/darwin_amd64.tar.gz"; | ||
}; | ||
aarch64-darwin.docker-credential-up = { | ||
hash = "sha256-gaaaOfn8oOxjlYruGePFZ+e65cUgRJSlsr4iweVYdSE="; | ||
url = "https://cli.upbound.io/stable/v0.36.1/bundle/docker-credential-up/darwin_arm64.tar.gz"; | ||
}; | ||
aarch64-linux.up = { | ||
hash = "sha256-mxuDhdO0nZkozMsKiKcDPBscgrY0pSChJP5TUJz729E="; | ||
url = "https://cli.upbound.io/stable/v0.36.1/bundle/up/linux_arm64.tar.gz"; | ||
}; | ||
x86_64-linux.up = { | ||
hash = "sha256-oZ1RpPZAKzChRWKUhUcKPRXhqmf3FBXvpFCICMsWh+w="; | ||
url = "https://cli.upbound.io/stable/v0.36.1/bundle/up/linux_amd64.tar.gz"; | ||
}; | ||
x86_64-darwin.up = { | ||
hash = "sha256-a4QsXlfmmFhRYxC0yZ7yVIHmP8VUgggfOZSenMXGlKA="; | ||
url = "https://cli.upbound.io/stable/v0.36.1/bundle/up/darwin_amd64.tar.gz"; | ||
}; | ||
aarch64-darwin.up = { | ||
hash = "sha256-PPHlADbIiQ/CAF746lulvuHjwwo1V563K9Haf/7IjEI="; | ||
url = "https://cli.upbound.io/stable/v0.36.1/bundle/up/darwin_arm64.tar.gz"; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash -p curl | ||
|
||
#set -euo pipefail | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) | ||
|
||
# value can be main | stable | ||
# Ensure at least one argument is passed | ||
if [[ $# -lt 1 ]]; then | ||
echo "Error: No argument provided. Please specify 'main' or 'stable'." | ||
exit 1 | ||
fi | ||
|
||
# Check if the first argument is 'main' or 'stable' | ||
if [[ "$1" == "main" || "$1" == "stable" ]]; then | ||
echo "Valid input: $1" | ||
else | ||
echo "Error: Invalid input. Please specify 'main' or 'stable'." | ||
exit 1 | ||
fi | ||
channel=$1 | ||
|
||
baseUrl="https://cli.upbound.io/${channel}" | ||
currentVersion=$(curl ${baseUrl}/current/version) | ||
|
||
version="${currentVersion:1}" | ||
|
||
declare -A archMapping | ||
archMapping["aarch64-darwin"]="darwin_arm64" | ||
archMapping["x86_64-darwin"]="darwin_amd64" | ||
archMapping["aarch64-linux"]="linux_arm64" | ||
archMapping["x86_64-linux"]="linux_amd64" | ||
|
||
archMapBlock= | ||
for key in "${!archMapping[@]}"; do | ||
line=$(printf "$key = \"${archMapping[$key]}\"; ") | ||
archMapBlock="$archMapBlock$line" | ||
done | ||
|
||
platformListBlock= | ||
for key in "${!archMapping[@]}"; do | ||
platformListBlock="$platformListBlock\"$key\" " | ||
done | ||
|
||
cmds=("docker-credential-up" "up") | ||
fetchurlAttrSetBlock= | ||
for cmd in "${cmds[@]}"; do | ||
for key in "${!archMapping[@]}"; do | ||
arch=${archMapping[$key]} | ||
url="${baseUrl}/v${version}/bundle/$cmd/${arch}.tar.gz"; | ||
hash=$(nix-prefetch-url $url) | ||
hash=$(nix hash convert "${hash}" --hash-algo sha256) | ||
fetchurlAttrSetBlock=" | ||
${fetchurlAttrSetBlock} | ||
$key.$cmd = { | ||
hash = \"${hash}\"; | ||
url = ${url}; | ||
};" | ||
done | ||
done | ||
|
||
OUT_FILE="$SCRIPT_DIR/sources-${channel}.nix" | ||
cat >$OUT_FILE <<EOF | ||
# Generated by "update.sh ${channel}" - do not update manually! | ||
{ | ||
version = "${version}"; | ||
platformList = [ | ||
${platformListBlock} | ||
]; | ||
archMap = { | ||
${archMapBlock} | ||
}; | ||
fetchurlAttrSet = { | ||
${fetchurlAttrSetBlock} | ||
}; | ||
} | ||
EOF | ||
|
||
nixfmt $OUT_FILE |