Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
mcantelon committed Oct 6, 2024
1 parent e2cc8b3 commit 40ca237
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
ARG TARGET=enduro
ARG GO_VERSION

FROM golang:${GO_VERSION}-bookworm AS deb_extractor
RUN cd /tmp && \
apt-get update && apt-get download libxml2-utils && \
mkdir /dpkg && \
for deb in *.deb; do dpkg --extract $deb /dpkg || exit 10; done

FROM golang:${GO_VERSION}-alpine AS build-go
WORKDIR /src
ENV CGO_ENABLED=0
Expand Down Expand Up @@ -66,5 +72,6 @@ FROM base AS enduro-am-worker
COPY --from=build-enduro-am-worker --link /out/enduro-am-worker /home/enduro/bin/enduro-am-worker
COPY --from=build-enduro-am-worker --link /src/enduro.toml /home/enduro/.config/enduro.toml
CMD ["/home/enduro/bin/enduro-am-worker", "--config", "/home/enduro/.config/enduro.toml"]
COPY --from=deb_extractor /dpkg /

FROM ${TARGET}
5 changes: 5 additions & 0 deletions cmd/enduro-am-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/artefactual-sdps/temporal-activities/bagcreate"
"github.com/artefactual-sdps/temporal-activities/bagvalidate"
"github.com/artefactual-sdps/temporal-activities/removepaths"
"github.com/artefactual-sdps/temporal-activities/xmlvalidate"
"github.com/hashicorp/go-cleanhttp"
"github.com/jonboulle/clockwork"
"github.com/oklog/run"
Expand Down Expand Up @@ -303,6 +304,10 @@ func main() {
removepaths.New().Execute,
temporalsdk_activity.RegisterOptions{Name: removepaths.Name},
)
w.RegisterActivityWithOptions(
xmlvalidate.New().Execute,
temporalsdk_activity.RegisterOptions{Name: xmlvalidate.Name},
)

g.Add(
func() error {
Expand Down
11 changes: 11 additions & 0 deletions internal/workflow/processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/artefactual-sdps/temporal-activities/bagcreate"
"github.com/artefactual-sdps/temporal-activities/bagvalidate"
"github.com/artefactual-sdps/temporal-activities/removepaths"
"github.com/artefactual-sdps/temporal-activities/xmlvalidate"
"github.com/google/uuid"
"go.artefactual.dev/tools/ref"
temporal_tools "go.artefactual.dev/tools/temporal"
Expand Down Expand Up @@ -417,6 +418,16 @@ func (w *ProcessingWorkflow) SessionHandler(
return err
}

// Validate PREMIS.
activityOpts := withActivityOptsForRequest(sessCtx)
err := temporalsdk_workflow.ExecuteActivity(activityOpts, xmlvalidate.Name, xmlvalidate.Params{
XMLFilePath: filepath.Join(tinfo.TempPath, "data", "metadata", "premis.xml"),
XSDFilePath: tinfo.TempPath,
}).Get(activityOpts, nil)
if err != nil {
return err
}

// Classify the SIP.
{
activityOpts := withActivityOptsForLocalAction(sessCtx)
Expand Down

0 comments on commit 40ca237

Please sign in to comment.