Skip to content

Commit

Permalink
Merge pull request #853 from emosbaugh/check-skipperfiles-archive
Browse files Browse the repository at this point in the history
Check skippedFiles archive
  • Loading branch information
emosbaugh committed Jul 24, 2020
2 parents a5ee157 + f85a6fd commit e147792
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 8 deletions.
6 changes: 5 additions & 1 deletion ffi/main.go
Expand Up @@ -98,7 +98,11 @@ func UpdateCheck(socket, fromArchivePath, namespace string) {
filepath.Join(tmpRoot, "upstream"),
filepath.Join(tmpRoot, "base"),
filepath.Join(tmpRoot, "overlays"),
filepath.Join(tmpRoot, "skippedFiles"),
}

skippedFilesPath := filepath.Join(tmpRoot, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

err = os.Remove(fromArchivePath)
Expand Down
6 changes: 5 additions & 1 deletion ffi/online.go
Expand Up @@ -161,7 +161,11 @@ func RewriteVersion(socket, fromArchivePath, outputFile, downstreamsStr, k8sName
filepath.Join(tmpRoot, "upstream"),
filepath.Join(tmpRoot, "base"),
filepath.Join(tmpRoot, "overlays"),
filepath.Join(tmpRoot, "skippedFiles"),
}

skippedFilesPath := filepath.Join(tmpRoot, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

if err := tarGz.Archive(paths, outputFile); err != nil {
Expand Down
12 changes: 10 additions & 2 deletions ffi/updatedownload.go
Expand Up @@ -119,7 +119,11 @@ func UpdateDownload(socket, fromArchivePath, namespace, registryJson, cursor str
filepath.Join(tmpRoot, "upstream"),
filepath.Join(tmpRoot, "base"),
filepath.Join(tmpRoot, "overlays"),
filepath.Join(tmpRoot, "skippedFiles"),
}

skippedFilesPath := filepath.Join(tmpRoot, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

err = os.Remove(fromArchivePath)
Expand Down Expand Up @@ -294,7 +298,11 @@ func UpdateDownloadFromAirgap(socket, fromArchivePath, namespace, registryJson,
filepath.Join(tmpRoot, "upstream"),
filepath.Join(tmpRoot, "base"),
filepath.Join(tmpRoot, "overlays"),
filepath.Join(tmpRoot, "skippedFiles"),
}

skippedFilesPath := filepath.Join(tmpRoot, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

err = os.Remove(fromArchivePath)
Expand Down
5 changes: 4 additions & 1 deletion integration/replicated/generate.go
Expand Up @@ -144,7 +144,10 @@ func generateExpectedFilesystem(namespace, rawArchivePath string) ([]byte, error
path.Join(tmpRootDir, "upstream"),
path.Join(tmpRootDir, "base"),
path.Join(tmpRootDir, "overlays"),
path.Join(tmpRootDir, "skippedFiles"),
}
skippedFilesPath := path.Join(tmpRootDir, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}
if err := tarGz.Archive(paths, archiveFile); err != nil {
return nil, errors.Wrap(err, "failed to create archive")
Expand Down
7 changes: 6 additions & 1 deletion kotsadm/pkg/handlers/download.go
Expand Up @@ -86,8 +86,13 @@ func DownloadApp(w http.ResponseWriter, r *http.Request) {
filepath.Join(archivePath, "upstream"),
filepath.Join(archivePath, "base"),
filepath.Join(archivePath, "overlays"),
filepath.Join(archivePath, "skippedFiles"),
}

skippedFilesPath := filepath.Join(archivePath, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

tmpDir, err := ioutil.TempDir("", "kotsadm")
if err != nil {
logger.Error(err)
Expand Down
6 changes: 5 additions & 1 deletion kotsadm/pkg/version/archive.go
Expand Up @@ -32,7 +32,11 @@ func CreateAppVersionArchive(appID string, sequence int64, archivePath string) e
filepath.Join(archivePath, "upstream"),
filepath.Join(archivePath, "base"),
filepath.Join(archivePath, "overlays"),
filepath.Join(archivePath, "skippedFiles"),
}

skippedFilesPath := filepath.Join(archivePath, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

tmpDir, err := ioutil.TempDir("", "kotsadm")
Expand Down
6 changes: 5 additions & 1 deletion pkg/pull/archive.go
Expand Up @@ -32,7 +32,11 @@ func writeArchiveAsConfigMap(pullOptions PullOptions, u *upstreamtypes.Upstream,
path.Join(pullOptions.RootDir, u.Name, "upstream"),
path.Join(pullOptions.RootDir, u.Name, "base"),
path.Join(pullOptions.RootDir, u.Name, "overlays"),
path.Join(pullOptions.RootDir, u.Name, "skippedFiles"),
}

skippedFilesPath := path.Join(pullOptions.RootDir, "skippedFiles")
if _, err := os.Stat(skippedFilesPath); err == nil {
paths = append(paths, skippedFilesPath)
}

tempDir, err := ioutil.TempDir("", "kots")
Expand Down

0 comments on commit e147792

Please sign in to comment.