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
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
name: Verify Release - Zip Files | ||
on: | ||
workflow_call: | ||
inputs: | ||
package-name: | ||
description: 'Name of consul release package (consul vs consul-enterprise)' | ||
required: true | ||
default: 'consul' | ||
type: string | ||
version: | ||
description: The x.y.z version (also need to specify applicable suffixes like +ent and -dev)' | ||
required: true | ||
type: string | ||
runs-on: | ||
description: An expression indicating which kind of runners to use. | ||
required: true | ||
type: string | ||
include-fips: | ||
description: Indicates whether we should check for FIPS binaries and docker images. Versions below 1.16.0 should be false. | ||
required: false | ||
type: boolean | ||
default: true | ||
jobs: | ||
verify-zips: | ||
runs-on: ${{ fromJSON(inputs.runs-on) }} | ||
strategy: | ||
matrix: | ||
release: [ { | ||
product: consul, | ||
targets: [ | ||
{ os: "darwin", arch: "amd64" }, | ||
{ os: "darwin", arch: "arm64" }, | ||
{ os: "freebsd", arch: "386" }, | ||
{ os: "freebsd", arch: "amd64" }, | ||
{ os: "linux", arch: "386" }, | ||
{ os: "linux", arch: "amd64" }, | ||
{ os: "linux", arch: "arm" }, | ||
{ os: "linux", arch: "arm64" }, | ||
{ os: "solaris", arch: "amd64" }, | ||
{ os: "windows", arch: "386" }, | ||
{ os: "windows", arch: "amd64" } | ||
] | ||
} | ||
] | ||
fail-fast: false | ||
steps: | ||
- name: verify zips | ||
run: | | ||
# zips=$(${{ toJSON(matrix.release.targets) }} | jq -r 'map(${{ inputs.package-name}} + "_" + ${{ inputs.version }} + "_" + .os + "_" + .arch + ".zip" )| join("|")' ) | ||
expected=$(${{ toJSON(matrix.release.targets) }} | jq '.results | length') | ||
found=$(curl https://releases.hashicorp.com/${{ matrix.product }}/${{ inputs.version }}/ \ | ||
| grep -E "blah" \ | ||
| wc -l \ | ||
| awk '$1=$1') | ||
if [[ ${found} != expected ]]; then | ||
echo "ERROR: incorrect number of zip files found. Expected: ${expected}. Found: ${found}" | ||
exit 1 | ||
fi | ||