@@ -69,37 +69,85 @@ jobs:
69
69
mkdir -p /tmp/artifacts
70
70
cd /tmp/artifacts
71
71
72
- # Download key artifacts to validate
73
- echo "Downloading Linux amd64 zip..."
74
- curl -L -o "terraform-provider-wallix-bastion_${TAG}_linux_amd64.zip" \
75
- "https://github.com/wallix/terraform-provider-wallix-bastion/releases/download/${TAG}/terraform-provider-wallix-bastion_${TAG}_linux_amd64.zip"
72
+ # Wait for release to be fully available
73
+ echo "Waiting for release artifacts to be available..."
74
+ sleep 30
76
75
77
- echo "Downloading Windows amd64 zip..."
78
- curl -L -o "terraform-provider-wallix-bastion_${TAG}_windows_amd64.zip" \
79
- "https://github.com/wallix/terraform-provider-wallix-bastion/releases/download/${TAG}/terraform-provider-wallix-bastion_${TAG}_windows_amd64.zip"
76
+ # Function to download with retries
77
+ download_with_retry() {
78
+ local url="$1"
79
+ local filename="$2"
80
+ local max_attempts=5
81
+ local attempt=1
82
+
83
+ while [ $attempt -le $max_attempts ]; do
84
+ echo "Attempt $attempt/$max_attempts: Downloading $filename..."
85
+ if curl -L -f -o "$filename" "$url"; then
86
+ # Check if we got an actual file, not an error page
87
+ if file "$filename" | grep -q "ASCII text"; then
88
+ echo "Got HTML error page, retrying..."
89
+ rm -f "$filename"
90
+ sleep 10
91
+ attempt=$((attempt + 1))
92
+ else
93
+ echo "Successfully downloaded $filename"
94
+ return 0
95
+ fi
96
+ else
97
+ echo "Download failed, retrying..."
98
+ sleep 10
99
+ attempt=$((attempt + 1))
100
+ fi
101
+ done
102
+
103
+ echo "Failed to download $filename after $max_attempts attempts"
104
+ return 1
105
+ }
106
+
107
+ # Download key artifacts to validate with retries
108
+ download_with_retry \
109
+ "https://github.com/wallix/terraform-provider-wallix-bastion/releases/download/${TAG}/terraform-provider-wallix-bastion_${TAG}_linux_amd64.zip" \
110
+ "terraform-provider-wallix-bastion_${TAG}_linux_amd64.zip"
80
111
81
- echo "Downloading checksums..."
82
- curl -L -o "terraform-provider-wallix-bastion_${TAG}_SHA256SUMS" \
83
- "https://github.com/wallix/terraform-provider-wallix-bastion/releases/download/${TAG}/terraform-provider-wallix-bastion_${TAG}_SHA256SUMS"
112
+ download_with_retry \
113
+ "https://github.com/wallix/terraform-provider-wallix-bastion/releases/download/${TAG}/terraform-provider-wallix-bastion_${TAG}_windows_amd64.zip" \
114
+ "terraform-provider-wallix-bastion_${TAG}_windows_amd64.zip"
115
+
116
+ download_with_retry \
117
+ "https://github.com/wallix/terraform-provider-wallix-bastion/releases/download/${TAG}/terraform-provider-wallix-bastion_${TAG}_SHA256SUMS" \
118
+ "terraform-provider-wallix-bastion_${TAG}_SHA256SUMS"
84
119
85
120
# Validate file types
86
- echo "\n=== Validating file types ==="
121
+ echo ""
122
+ echo "=== Validating file types ==="
87
123
echo "Linux zip:"
88
124
file "terraform-provider-wallix-bastion_${TAG}_linux_amd64.zip"
89
125
90
126
echo "Windows zip:"
91
127
file "terraform-provider-wallix-bastion_${TAG}_windows_amd64.zip"
92
128
93
129
# Test extraction
94
- echo "\n=== Testing archive extraction ==="
130
+ echo ""
131
+ echo "=== Testing archive extraction ==="
95
132
echo "Testing Linux zip extraction:"
96
- unzip -l "terraform-provider-wallix-bastion_${TAG}_linux_amd64.zip" | head -10
133
+ if unzip -l "terraform-provider-wallix-bastion_${TAG}_linux_amd64.zip" | head -10; then
134
+ echo "✓ Linux zip extraction successful"
135
+ else
136
+ echo "✗ Linux zip extraction failed"
137
+ exit 1
138
+ fi
97
139
98
140
echo "Testing Windows zip extraction:"
99
- unzip -l "terraform-provider-wallix-bastion_${TAG}_windows_amd64.zip" | head -10
141
+ if unzip -l "terraform-provider-wallix-bastion_${TAG}_windows_amd64.zip" | head -10; then
142
+ echo "✓ Windows zip extraction successful"
143
+ else
144
+ echo "✗ Windows zip extraction failed"
145
+ exit 1
146
+ fi
100
147
101
148
# Validate checksums exist
102
- echo "\n=== Validating checksums ==="
149
+ echo ""
150
+ echo "=== Validating checksums ==="
103
151
if [ -f "terraform-provider-wallix-bastion_${TAG}_SHA256SUMS" ]; then
104
152
echo "Checksums file found, checking format:"
105
153
head -5 "terraform-provider-wallix-bastion_${TAG}_SHA256SUMS"
@@ -118,8 +166,10 @@ jobs:
118
166
fi
119
167
120
168
# Verify one checksum
121
- echo "\n=== Verifying checksum ==="
169
+ echo ""
170
+ echo "=== Verifying checksum ==="
122
171
sha256sum "terraform-provider-wallix-bastion_${TAG}_linux_amd64.zip"
123
172
grep "terraform-provider-wallix-bastion_${TAG}_linux_amd64.zip" "terraform-provider-wallix-bastion_${TAG}_SHA256SUMS"
124
173
125
- echo "\n=== Validation completed successfully! ==="
174
+ echo ""
175
+ echo "=== Validation completed successfully! ==="
0 commit comments