Skip to content

Commit

Permalink
Update runner base image + tweaks to support it
Browse files Browse the repository at this point in the history
This PR updates the runner base image to fix something I noticed in an Azure run that the RMI folk have since fixed.

There have been some small format tweaks in the mean time:
- More file types outputted by the report generation flow
- `Files` is now an array of strings
  • Loading branch information
bcspragu committed Dec 7, 2024
1 parent 4dc23b1 commit a0039da
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)
Expand Down
18 changes: 12 additions & 6 deletions async/async.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
},
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/parser/configs/test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/runner/configs/test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 34 additions & 0 deletions db/sqldb/migrations/0016_add_more_report_file_types.down.sql
Original file line number Diff line number Diff line change
@@ -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;
7 changes: 7 additions & 0 deletions db/sqldb/migrations/0016_add_more_report_file_types.up.sql
Original file line number Diff line number Diff line change
@@ -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;
34 changes: 22 additions & 12 deletions pacta/pacta.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -243,6 +246,7 @@ var FileTypeValues = []FileType{
FileType_PNG,
FileType_JPG,
FileType_PDF,
FileType_XLSX,
FileType_UNKNOWN,
}

Expand All @@ -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":
Expand All @@ -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
}
Expand Down

0 comments on commit a0039da

Please sign in to comment.