diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8e408a5..09345c6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -69,7 +69,7 @@ jobs: containerAppEnvironment: pacta-test resourceGroup: RMI-SP-PACTA-WEU-PAT-DEV imageToDeploy: rmisppactaweupatdev.azurecr.io/pacta:test - location: centralus + location: westeurope - name: Deploy frontend uses: Azure/static-web-apps-deploy@v1 diff --git a/WORKSPACE b/WORKSPACE index 6b820a8..48f2191 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -104,8 +104,8 @@ oci_pull( oci_pull( name = "runner_base", - # This digest is of the nightly/main tag as of 2024-07-22 - digest = "sha256:7adec544294b5cb9e11c6bb4c43d0b2de646e5f933639f86c85f3f03c99f650e", + # This digest is of the nightly/main tag as of 2024-12-06 + digest = "sha256:35c8eaac721350ca6ef3bfb3e6080c5412ddb9061299c62bb4fd2fc6df8d0227", image = "ghcr.io/rmi-pacta/workflow.pacta.webapp", platforms = ["linux/amd64"], ) diff --git a/async/async.go b/async/async.go index 100edc7..2363b47 100644 --- a/async/async.go +++ b/async/async.go @@ -241,9 +241,9 @@ type ReportInput struct { } type ReportInputPortfolio struct { - Files string `json:"files"` - HoldingsDate string `json:"holdingsDate"` - Name string `json:"name"` + Files []string `json:"files"` + HoldingsDate string `json:"holdingsDate"` + Name string `json:"name"` } type ReportEnv struct { @@ -378,7 +378,7 @@ func (h *Handler) CreateReport(ctx context.Context, taskID task.ID, req *task.Cr inp := ReportInput{ Portfolio: ReportInputPortfolio{ - Files: fileNameWithExt, + Files: []string{fileNameWithExt}, HoldingsDate: "2023-12-31", // TODO(#206) Name: "FooPortfolio", // TODO(#206) }, @@ -499,7 +499,7 @@ func (h *Handler) uploadDirectory(ctx context.Context, dirPath, container string // Returns pacta.FileType_UNKNOWN for unrecognized extensions, which we'll serve as binary blobs. ft := fileTypeFromFilename(fn) if ft == pacta.FileType_UNKNOWN { - h.logger.Error("unhandled file extension", zap.String("dir", dirPath), zap.String("file_ext", filepath.Ext(fn))) + h.logger.Error("unhandled file extension", zap.String("dir", dirPath), zap.String("filename", fn), zap.String("file_ext", filepath.Ext(fn))) } artifacts = append(artifacts, &task.AnalysisArtifact{ BlobURI: pacta.BlobURI(uri), @@ -538,6 +538,8 @@ func fileTypeFromFilename(fn string) pacta.FileType { switch ext2 := filepath.Ext(strings.TrimSuffix(fn, ext)); ext2 { case ".js": return pacta.FileType_JS_MAP + case ".css": + return pacta.FileType_CSS_MAP default: return pacta.FileType_UNKNOWN } @@ -556,7 +558,11 @@ func fileTypeFromFilename(fn string) pacta.FileType { case ".jpg": return pacta.FileType_JPG case ".pdf": - return pacta.FileType_TTF + return pacta.FileType_PDF + case ".xlsx": + return pacta.FileType_XLSX + case ".rds": + return pacta.FileType_RDS default: return pacta.FileType_UNKNOWN } diff --git a/cmd/parser/configs/test.conf b/cmd/parser/configs/test.conf index c7c4b34..c416609 100644 --- a/cmd/parser/configs/test.conf +++ b/cmd/parser/configs/test.conf @@ -2,7 +2,7 @@ env test min_log_level warn azure_event_topic pacta-events-test -azure_topic_location centralus-1 +azure_topic_location westeurope-1 azure_storage_account rmipactatest azure_dest_portfolio_container parsedportfolios diff --git a/cmd/runner/configs/test.conf b/cmd/runner/configs/test.conf index 84eda68..7907224 100644 --- a/cmd/runner/configs/test.conf +++ b/cmd/runner/configs/test.conf @@ -2,7 +2,7 @@ env test min_log_level warn azure_event_topic pacta-events-test -azure_topic_location centralus-1 +azure_topic_location westeurope-1 azure_storage_account rmipactatest azure_report_container reports diff --git a/db/sqldb/migrations/0016_add_more_report_file_types.down.sql b/db/sqldb/migrations/0016_add_more_report_file_types.down.sql new file mode 100644 index 0000000..8771069 --- /dev/null +++ b/db/sqldb/migrations/0016_add_more_report_file_types.down.sql @@ -0,0 +1,34 @@ +BEGIN; + +-- There isn't a way to delete a value from an enum, so this is the workaround +-- https://stackoverflow.com/a/56777227/17909149 + +ALTER TABLE blob ALTER file_type TYPE TEXT; + +DROP TYPE file_type; +CREATE TYPE file_type AS ENUM ( + 'csv', + 'yaml', + 'zip', + 'html', + 'json', + 'txt', + 'css', + 'js', + 'ttf', + 'unknown', + 'js.map', + 'woff', + 'woff2', + 'eot', + 'svg', + 'png', + 'jpg', + 'pdf' +); + +ALTER TABLE blob + ALTER file_type TYPE file_type + USING file_type::file_type; + +COMMIT; diff --git a/db/sqldb/migrations/0016_add_more_report_file_types.up.sql b/db/sqldb/migrations/0016_add_more_report_file_types.up.sql new file mode 100644 index 0000000..3cd6ea6 --- /dev/null +++ b/db/sqldb/migrations/0016_add_more_report_file_types.up.sql @@ -0,0 +1,7 @@ +BEGIN; + +ALTER TYPE file_type ADD VALUE 'xlsx'; +ALTER TYPE file_type ADD VALUE 'rds'; +ALTER TYPE file_type ADD VALUE 'css.map'; + +COMMIT; diff --git a/pacta/pacta.go b/pacta/pacta.go index 54ca75f..f191059 100644 --- a/pacta/pacta.go +++ b/pacta/pacta.go @@ -208,18 +208,21 @@ const ( FileType_JSON = "json" // All for serving reports - FileType_TEXT = "txt" - FileType_CSS = "css" - FileType_JS = "js" - FileType_JS_MAP = "js.map" - FileType_TTF = "ttf" - FileType_WOFF = "woff" - FileType_WOFF2 = "woff2" - FileType_EOT = "eot" - FileType_SVG = "svg" - FileType_PNG = "png" - FileType_JPG = "jpg" - FileType_PDF = "pdf" + FileType_TEXT = "txt" + FileType_CSS = "css" + FileType_CSS_MAP = "css.map" + FileType_JS = "js" + FileType_JS_MAP = "js.map" + FileType_TTF = "ttf" + FileType_WOFF = "woff" + FileType_WOFF2 = "woff2" + FileType_EOT = "eot" + FileType_SVG = "svg" + FileType_PNG = "png" + FileType_JPG = "jpg" + FileType_PDF = "pdf" + FileType_XLSX = "xlsx" + FileType_RDS = "rds" FileType_UNKNOWN = "unknown" ) @@ -243,6 +246,7 @@ var FileTypeValues = []FileType{ FileType_PNG, FileType_JPG, FileType_PDF, + FileType_XLSX, FileType_UNKNOWN, } @@ -266,6 +270,8 @@ func ParseFileType(s string) (FileType, error) { return FileType_TEXT, nil case "css": return FileType_CSS, nil + case "css.map": + return FileType_CSS_MAP, nil case "js": return FileType_JS, nil case "js.map": @@ -286,6 +292,10 @@ func ParseFileType(s string) (FileType, error) { return FileType_JPG, nil case "pdf": return FileType_PDF, nil + case "xlsx": + return FileType_XLSX, nil + case "rds": + return FileType_RDS, nil case "unknown": return FileType_UNKNOWN, nil }