blob: 8a55864c3750be093eb37760f1b753db59817bbd [file]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
version: 3
vars:
OS: "{{or .__OS OS}}"
BOH: "{{.__ARCH}}"
ARCH: "{{or .__ARCH ARCH}}"
ARC: '{{if eq .OS "windows"}}.zip{{else}}.tgz{{end}}'
ARC2: '{{if eq .OS "windows"}}.zip{{else}}.tar.gz{{end}}'
EXE: '{{if eq .OS "windows"}}.exe{{else}}{{end}}'
tasks:
info:
- echo "__ARCH={{.__ARCH}} BOH={{.BOH}}"
- echo "OS={{.OS}} ARCH={{.ARCH}} ARC={{.ARC}} EXE={{.EXE}}"
download-and-extract:
requires:
vars:
- FILE
- URL
- OUT
vars:
FILETAR: '{{trimSuffix ".gz" .FILE}}'
cmds:
- echo "{{.OUT}} {{.FILE}} {{.URL}} {{.FILETAR}}"
- curl -sL "{{.URL}}" -o {{.FILE}}
- |
{{if eq .OS "windows"}}
7zz e -r -aoa -o. "{{.FILE}}" "{{.OUT}}.exe"
rm "{{.FILE}}"
{{else}}
7zz e "{{.FILE}}" -o.
rm "{{.FILE}}"
7zz e -r -aoa -o. "{{.FILETAR}}" "{{.OUT}}"
rm "{{.FILETAR}}"
{{end}}
download:
requires:
vars:
- URL
- OUT
cmds:
- curl -sL -ccookie.txt -o"{{.OUT}}" "{{.URL}}"
- '{{if eq .OS "windows"}}mv {{.OUT}} {{.OUT}}.exe{{else}}chmod +x {{.OUT}}{{end}}'
- rm cookie.txt
7zz:
desc: 7zr
vars:
VERSION: "2301"
SUFFIX:
sh: |
case "{{.OS}}-{{.ARCH}}" in
linux-amd64) echo "7z{{.VERSION}}-linux-x64.tar.xz" ;;
linux-arm64) echo "7z{{.VERSION}}-linux-arm64.tar.xz" ;;
darwin-*) echo "7z{{.VERSION}}-mac.tar.xz" ;;
windows-*) echo "7zr.exe" ;;
*) echo "unknown" ;;
esac
URL: "https://7-zip.org/a/{{.SUFFIX}}"
FILE: "{{base .URL}}"
cmds:
- curl -fsSL --retry 3 "{{.URL}}" -o "{{.FILE}}"
- |
if test "{{.OS}}" == "windows"
then mv 7zr.exe 7zz.exe
else tar xJvf "{{.FILE}}" 7zz
rm "{{.FILE}}"
fi
coreutils:
desc: coreutils
vars:
XVERSION: "0.0.27"
SUFFIX:
sh: |
case "{{.OS}}-{{.ARCH}}" in
linux-amd64) echo "x86_64-unknown-linux-gnu" ;;
linux-arm64) echo "aarch64-unknown-linux-gnu" ;;
darwin-amd64) echo "x86_64-apple-darwin" ;;
darwin-arm64) echo "aarch64-apple-darwin" ;;
windows-*) echo "x86_64-pc-windows-gnu" ;;
*) echo "unknown" ;;
esac
URL: "https://github.com/uutils/coreutils/releases/download/{{.VERSION}}/coreutils-{{.VERSION}}-{{.SUFFIX}}{{.ARC2}}"
FILE: "{{base .URL}}"
OUT: coreutils
cmds:
- task: download-and-extract
vars:
URL: "{{.URL}}"
FILE: "{{.FILE}}"
OUT: coreutils
bun:
description: bun
vars:
XVERSION: "1.1.21"
ARCH2: '{{if eq .ARCH "amd64"}}x64{{else}}aarch64{{end}}'
URL: 'https://github.com/oven-sh/bun/releases/download/bun-v{{.VERSION}}/bun-{{.OS}}-{{.ARCH2}}.zip'
FILE: '{{base .URL}}'
cmds:
- echo "{{.URL}}"
- curl -sL "{{.URL}}" -o "{{.FILE}}"
- 7zz e -r -aoa -o. {{.FILE}} bun{{.EXE}}
- rm "{{.FILE}}"
kubectl:
vars:
XVERSION: v1.30.3
cmds:
- task: download
vars:
URL: "https://dl.k8s.io/release/{{.VERSION}}/bin/{{.OS}}/{{.ARCH}}/kubectl{{.EXE}}"
OUT: kubectl
kind:
vars:
XVERSION: 0.17.0
cmds:
- task: download
vars:
URL: "https://kind.sigs.k8s.io/dl/v{{.VERSION}}/kind-{{.OS}}-{{.ARCH}}"
OUT: kind
k3sup:
vars:
XVERSION: 0.13.6
BASE: "https://github.com/alexellis/k3sup/releases/download/{{.VERSION}}"
FILE:
sh: |
case {{.OS}}-{{.ARCH}} in
(linux-amd64) echo k3sup ;;
(linux-arm64) echo k3sup-arm64 ;;
(darwin-amd64) echo k3sup-darwin ;;
(darwin-arm64) echo k3sup-darwin-arm64 ;;
(windows-amd64) echo k3sup.exe ;;
esac
cmds:
- task: download
vars:
URL: "{{.BASE}}/{{.FILE}}"
OUT: k3sup
all:
- task: 7zz
# skipping
#- task: coreutils
#- task: bun
#- task: kind
#- task: k3sup
#- task: kubectl