Skip to content

Commit 9fec233

Browse files
committed
templatize: retry aware arm deployment names
simplify the ARM deployment name approach by making the retry attempt part of the original digest compuation Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
1 parent 3aa85a1 commit 9fec233

File tree

1 file changed

+2
-11
lines changed
  • tooling/templatize/pkg/pipeline

1 file changed

+2
-11
lines changed

tooling/templatize/pkg/pipeline/arm.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"context"
1919
"errors"
2020
"fmt"
21-
"hash/crc32"
2221
"maps"
2322
"math/rand"
2423
"net/http"
@@ -311,6 +310,7 @@ func doWaitForDeployment(ctx context.Context, bicepClient *bicep.LSPClient, clie
311310
Properties: deploymentProperties,
312311
ResourceGroup: rgName,
313312
DeploymentLevel: step.DeploymentLevel,
313+
RetryAttempt: retryAttempt,
314314
}
315315

316316
digest, skip, commit, err := checkCachedOutput[ArmOutput](logger, inputs, stepCacheDir)
@@ -326,16 +326,6 @@ func doWaitForDeployment(ctx context.Context, bicepClient *bicep.LSPClient, clie
326326
if digest != "" {
327327
deploymentName = digest
328328
}
329-
// for retries, append retry attempt to deployment name so we can keep the previous failed deployment around for debugging purposes
330-
if retryAttempt > 0 {
331-
checksum := fmt.Sprintf("%08x", crc32.ChecksumIEEE([]byte(deploymentName)))
332-
suffix := fmt.Sprintf("-r%d-%s", retryAttempt, checksum)
333-
maxBaseLen := 64 - len(suffix)
334-
if len(deploymentName) > maxBaseLen {
335-
deploymentName = deploymentName[:maxBaseLen]
336-
}
337-
deploymentName += suffix
338-
}
339329

340330
var output ArmOutput
341331
var details DetailsProducer
@@ -443,6 +433,7 @@ type deploymentInputs struct {
443433
Properties *armresources.DeploymentProperties
444434
ResourceGroup string
445435
DeploymentLevel string
436+
RetryAttempt int `json:"retryAttempt,omitempty"`
446437
}
447438

448439
// computeResourceGroupTags determines the final tags for a resource group based on existing tags and persist settings.

0 commit comments

Comments
 (0)