-
Notifications
You must be signed in to change notification settings - Fork 4.4k
96 lines (90 loc) · 3.27 KB
/
reusable-verify-release-zip.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
name: Verify Release - Zip Files
on:
workflow_call:
inputs:
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: [ {
name: oss,
suffix: "",
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" }
],
fips: false
},
{
name: enterprise,
suffix: "\+ent",
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" }
],
fips: false
},
{
name: ent-fips,
suffix: "\+ent\.fips1402",
targets: [
{ os: "linux", arch: "amd64" },
{ os: "linux", arch: "arm64" },
{ os: "windows", arch: "amd64" },
{ os: "windows", arch: "arm64" }
],
fips: true
}
]
fail-fast: false
steps:
- name: verify zips - ${{ matrix.release.name }}
if: ${{ !matrix.release.fips || (inputs.include-fips && matrix.release.fips) }}
run: |
export zips=$(echo '${{ toJSON(matrix.release.targets) }}' | jq -r 'map("consul" + "_" + "${{ inputs.version }}" + "${{ matrix.release.suffix }}" + "_" + .os + "_" + .arch + "\.zip" )| join("|")')
echo "zips: ${zips}"
expected=$(echo '${{ toJSON(matrix.release.targets) }}' | jq length)
curl https://releases.hashicorp.com/consul/${{ inputs.version }}${{ matrix.release.suffix }}
found=$(curl https://releases.hashicorp.com/consul/${{ inputs.version }}${{ matrix.release.suffix }}/ \
| grep -E "${zips}" \
| wc -l \
| awk '$1=$1')
echo "Expected: ${expected}. Found: ${found}"
if [[ ${found} != ${expected} ]]; then
echo "ERROR: incorrect number of zip files found."
exit 1
fi