version: '3' requires: vars: [OUTPUT_BASE] tasks: prometheus:debug: cmds: - echo {{.GOOS}} prometheus:download-*-*: desc: Download and extract prometheus binary vars: VERSION: '2.53.4' GOOS: '{{index .MATCH 0}}' GOARCH: '{{index .MATCH 1}}' TEMPFILE: {sh: mktemp} SHA256: '{{printf "%v/%v" .GOOS .GOARCH | get (dict "linux/amd64" "b8b497c4610d1b93208252b60c8f20f6b2e78596ae8df43397a2e805aa53d475" "linux/arm64" "ec7236ecea7154d0bfe142921708b1ae7b5e921e100e0ee85ab92b7c444357e0" "darwin/amd64" "10066a1aa21c4ddb8d5e61c31b52e898d8ac42c7e99fd757e2fc4b6c20b8075f" "darwin/arm64" "cb3e638d8e9b4b27a6aa1f45a4faa3741b548aac67d4649aea7a2fad3c09f0a1" ) }}' TARGET_DIR: '{{joinPath .OUTPUT_BASE "prometheus" .GOOS .GOARCH}}' TARGET: '{{joinPath .TARGET_DIR "prometheus"}}' generates: ['{{.TARGET}}'] sources: ['Taskfile.yml'] preconditions: - {sh: "[[ '{{.GOOS}}' =~ 'linux|darwin' ]]", msg: "invalid GOOS {{.GOOS}}"} - {sh: "[[ '{{.GOARCH}}' =~ 'amd64|arm64' ]]", msg: "invalid GOARCH {{.GOARCH}}"} cmds: - node '{{joinPath .ROOT_DIR "src/build/download_file.mjs"}}' --url='https://github.com/prometheus/prometheus/releases/download/v{{.VERSION}}/prometheus-{{.VERSION}}.{{.GOOS}}-{{.GOARCH}}.tar.gz' --out='{{.TEMPFILE}}' --sha256='{{.SHA256}}' - defer: rm -f '{{.TEMPFILE}}' - mkdir -p '{{.TARGET_DIR}}' - tar -zx -f '{{.TEMPFILE}}' --strip-components=1 -C '{{.TARGET_DIR}}' 'prometheus-{{.VERSION}}.{{.GOOS}}-{{.GOARCH}}/prometheus' - chmod +x '{{.TARGET}}' prometheus:copy-*-*: desc: Copy prometheus binary to target directory requires: vars: [TARGET_DIR] vars: GOOS: '{{index .MATCH 0}}' GOARCH: '{{index .MATCH 1}}' cmds: - task: prometheus:download-{{.GOOS}}-{{.GOARCH}} - mkdir -p '{{.TARGET_DIR}}' - cp -R '{{joinPath .OUTPUT_BASE "prometheus" .GOOS .GOARCH}}'/* '{{.TARGET_DIR}}/'