Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ortel <jortel@redhat.com>
  • Loading branch information
jortel committed Aug 24, 2023
1 parent e294f03 commit 37ce797
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ RUN git clone https://github.com/konveyor/tackle2-seed
FROM quay.io/konveyor/static-report as report

FROM registry.access.redhat.com/ubi9/ubi-minimal
ENV REPORT_BUNDLE_PATH=/report
COPY --from=builder /opt/app-root/src/bin/hub /usr/local/bin/tackle-hub
COPY --from=builder /opt/app-root/src/auth/roles.yaml /tmp/roles.yaml
COPY --from=builder /opt/app-root/src/auth/users.yaml /tmp/users.yaml
COPY --from=builder /opt/app-root/src/tackle2-seed/resources/ /tmp/seed
COPY --from=report /usr/local/static-report $REPORT_BUNDLE_PATH
COPY --from=report /usr/local/static-report /tmp/report

RUN microdnf -y install \
sqlite \
Expand Down
5 changes: 2 additions & 3 deletions api/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,11 @@ func (h AnalysisHandler) AppLatest(ctx *gin.Context) {
defer func() {
_ = os.Remove(path)
}()
bundle := Settings.ReportBundle.Path
tarWriter := tar.NewWriter(ctx.Writer)
defer func() {
tarWriter.Close()
}()
err = tarWriter.AssertDir(bundle)
err = tarWriter.AssertDir(Settings.Report.Path)
if err != nil {
_ = ctx.Error(err)
return
Expand All @@ -163,7 +162,7 @@ func (h AnalysisHandler) AppLatest(ctx *gin.Context) {
}
h.Attachment(ctx, fmt.Sprintf("%s.tar.gz", m.Application.Name))
ctx.Status(http.StatusOK)
_ = tarWriter.AddDir(bundle)
_ = tarWriter.AddDir(Settings.Report.Path)
_ = tarWriter.AddFile(path, "output.js")
} else {
writer := AnalysisWriter{ctx: ctx}
Expand Down
10 changes: 5 additions & 5 deletions settings/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
EnvFileTTL = "FILE_TTL"
EnvAppName = "APP_NAME"
EnvDisconnected = "DISCONNECTED"
EnvStaticReportPath = "REPORT_BUNDLE_PATH"
EnvReportPath = "REPORT_PATH"
)

type Hub struct {
Expand Down Expand Up @@ -78,8 +78,8 @@ type Hub struct {
Product bool
// Disconnected indicates no cluster.
Disconnected bool
// ReportBundle settings.
ReportBundle struct {
// Report settings.
Report struct {
Path string
}
}
Expand Down Expand Up @@ -195,9 +195,9 @@ func (r *Hub) Load() (err error) {
b, _ := strconv.ParseBool(s)
r.Disconnected = b
}
r.ReportBundle.Path, found = os.LookupEnv(EnvStaticReportPath)
r.Report.Path, found = os.LookupEnv(EnvReportPath)
if !found {
r.ReportBundle.Path = "/tmp/static-report"
r.Report.Path = "/tmp/report"
}

return
Expand Down

0 comments on commit 37ce797

Please sign in to comment.