in projects/aws/image-builder/builder/artifacts.go [17:63]
func (b *BuildOptions) DownloadArtifacts() error {
// Default arch if not set
if b.Arch == "" {
b.Arch = amd64
}
// Clone build tooling from the latest release branch
cwd, err := os.Getwd()
if err != nil {
return fmt.Errorf("Error retrieving current working directory: %v", err)
}
buildToolingRepoPath := getBuildToolingPath(cwd)
bundles, _, err := b.prepBuildToolingRepo(buildToolingRepoPath)
if err != nil {
return err
}
supportedReleaseBranches := GetSupportedReleaseBranches()
if !SliceContains(supportedReleaseBranches, b.ReleaseChannel) {
cleanup(buildToolingRepoPath)
log.Fatalf("release-channel should be one of %v", supportedReleaseBranches)
}
kubeVersion := strings.ReplaceAll(b.ReleaseChannel, "-", ".")
log.Printf("Setting Kubernetes Version: %s", kubeVersion)
// Download eks-a artifacts
eksaArtifactsPath := filepath.Join(cwd, eksAnywhereArtifactsDirName)
eksdArtifactsPath := filepath.Join(cwd, eksDistroArtifactsDirName)
if b.Force {
cleanup(eksaArtifactsPath)
cleanup(eksdArtifactsPath)
}
versionBundle, err := b.downloadEKSAArtifacts(eksaArtifactsPath, kubeVersion, bundles)
if err != nil {
return fmt.Errorf("failed to download eks-a artifacts: %v", err)
}
// Download eks-d artifacts
eksDReleaseManifestUrl := versionBundle.EksD.EksDReleaseUrl
if err := b.downloadEKSDArtifacts(eksdArtifactsPath, eksDReleaseManifestUrl); err != nil {
return fmt.Errorf("failed to download eks-d artifacts: %v", err)
}
cleanup(buildToolingRepoPath)
log.Println("All artifacts were successfully downloaded")
log.Printf("Please find EKS-A artifacts under %s and EKS-D artifacts under %s directories\n", eksAnywhereArtifactsDirName, eksDistroArtifactsDirName)
return nil
}