From 8c991d2e3ccfc51ca12c81932a3d51fc3e101912 Mon Sep 17 00:00:00 2001 From: mitchell Date: Thu, 14 Dec 2023 17:39:32 -0500 Subject: [PATCH 1/2] Fix build failures. --- internal/runners/initialize/init.go | 2 +- pkg/platform/api/buildplanner/request/createproject.go | 4 ++-- pkg/platform/api/buildplanner/request/mergecommit.go | 4 ++-- pkg/platform/api/buildplanner/request/revertcommit.go | 4 ++-- pkg/platform/model/buildplanner.go | 4 ++-- pkg/platform/model/vcs.go | 3 --- test/integration/import_int_test.go | 4 ++-- test/integration/publish_int_test.go | 10 +++++----- 8 files changed, 16 insertions(+), 19 deletions(-) diff --git a/internal/runners/initialize/init.go b/internal/runners/initialize/init.go index f033986e82..12ba69d66d 100644 --- a/internal/runners/initialize/init.go +++ b/internal/runners/initialize/init.go @@ -251,7 +251,7 @@ func (r *Initialize) Run(params *RunParams) (rerr error) { Language: lang.Requirement(), Version: version, Private: params.Private, - Timestamp: ×tamp, + Timestamp: timestamp, Description: locale.T("commit_message_add_initial"), }) if err != nil { diff --git a/pkg/platform/api/buildplanner/request/createproject.go b/pkg/platform/api/buildplanner/request/createproject.go index 81551b7d8b..221f9f86ff 100644 --- a/pkg/platform/api/buildplanner/request/createproject.go +++ b/pkg/platform/api/buildplanner/request/createproject.go @@ -52,6 +52,6 @@ mutation ($organization: String!, $project: String!, $private: Boolean!, $expr: }` } -func (c *createProject) Vars() map[string]interface{} { - return c.vars +func (c *createProject) Vars() (map[string]interface{}, error) { + return c.vars, nil } diff --git a/pkg/platform/api/buildplanner/request/mergecommit.go b/pkg/platform/api/buildplanner/request/mergecommit.go index d4ce1ace25..413432744e 100644 --- a/pkg/platform/api/buildplanner/request/mergecommit.go +++ b/pkg/platform/api/buildplanner/request/mergecommit.go @@ -71,6 +71,6 @@ mutation ($organization: String!, $project: String!, $targetRef: String!, $other ` } -func (b *mergeCommit) Vars() map[string]interface{} { - return b.vars +func (b *mergeCommit) Vars() (map[string]interface{}, error) { + return b.vars, nil } diff --git a/pkg/platform/api/buildplanner/request/revertcommit.go b/pkg/platform/api/buildplanner/request/revertcommit.go index 70c0829f7a..9cbe101ecc 100644 --- a/pkg/platform/api/buildplanner/request/revertcommit.go +++ b/pkg/platform/api/buildplanner/request/revertcommit.go @@ -74,6 +74,6 @@ mutation ($organization: String!, $project: String!, $commitId: String!, $target }` } -func (r *revertCommit) Vars() map[string]interface{} { - return r.vars +func (r *revertCommit) Vars() (map[string]interface{}, error) { + return r.vars, nil } diff --git a/pkg/platform/model/buildplanner.go b/pkg/platform/model/buildplanner.go index 9df3f80c05..95339e1d38 100644 --- a/pkg/platform/model/buildplanner.go +++ b/pkg/platform/model/buildplanner.go @@ -329,7 +329,7 @@ type CreateProjectParams struct { Language string Version string Private bool - Timestamp *time.Time + Timestamp time.Time Description string Expr *buildexpression.BuildExpression } @@ -361,7 +361,7 @@ func (bp *BuildPlanner) CreateProject(params *CreateProjectParams) (strfmt.UUID, }) // Add the timestamp. - expr.UpdateTimestamp(*params.Timestamp) + expr.UpdateTimestamp(params.Timestamp) } // Create the project. diff --git a/pkg/platform/model/vcs.go b/pkg/platform/model/vcs.go index 915a683cfb..40295f3643 100644 --- a/pkg/platform/model/vcs.go +++ b/pkg/platform/model/vcs.go @@ -84,9 +84,6 @@ const ( // NamespaceOrgMatch is the namespace used for org specific requirements NamespaceOrgMatch = `^org\/` - // NamespaceSharedMatch is the namespace used for shared requirements (usually runtime libraries) - NamespaceSharedMatch = `^shared$` - // NamespaceBuildFlagsMatch is the namespace used for passing build flags NamespaceBuildFlagsMatch = `^build-flags$` ) diff --git a/test/integration/import_int_test.go b/test/integration/import_int_test.go index d94a86eca3..20546ea17f 100644 --- a/test/integration/import_int_test.go +++ b/test/integration/import_int_test.go @@ -81,8 +81,8 @@ func (suite *ImportIntegrationTestSuite) TestImport() { ts := e2e.New(suite.T(), false) defer ts.Close() - username, _ := ts.CreateNewUser() - namespace := fmt.Sprintf("%s/%s", username, "Python3") + user := ts.CreateNewUser() + namespace := fmt.Sprintf("%s/%s", user.Username, "Python3") cp := ts.Spawn("init", "--language", "python", namespace, ts.Dirs.Work) cp.Expect("successfully initialized") diff --git a/test/integration/publish_int_test.go b/test/integration/publish_int_test.go index 4d65f2e3b1..7a517fb443 100644 --- a/test/integration/publish_int_test.go +++ b/test/integration/publish_int_test.go @@ -135,7 +135,7 @@ namespace: org/{{.Username}} version: 2.3.4 description: im-a-description authors: - - name: author-name + - name: author-name email: author-email@domain.tld `), nil, @@ -168,7 +168,7 @@ namespace: org/{{.Username}} version: 2.3.4 description: im-a-description authors: - - name: author-name + - name: author-name email: author-email@domain.tld `), nil, @@ -202,7 +202,7 @@ namespace: org/{{.Username}} version: 2.3.4 description: im-a-description authors: - - name: author-name + - name: author-name email: author-email@domain.tld `), true, @@ -363,7 +363,7 @@ authors: } cp := ts.SpawnWithOpts( - e2e.WithArgs(append([]string{"publish"}, args...)...), + e2e.OptArgs(append([]string{"publish"}, args...)...), ) if inv.expect.immediateOutput != "" { @@ -398,7 +398,7 @@ authors: cp.Expect("Y/n") - snapshot := cp.MatchState().TermState.String() + snapshot := cp.Snapshot() rx := regexp.MustCompile(`(?s)Publish following ingredient\?(.*)\(Y/n`) match := rx.FindSubmatch([]byte(snapshot)) suite.Require().NotNil(match, fmt.Sprintf("Could not match '%s' against: %s", rx.String(), snapshot)) From a43fb068f00b31235e254632380f2abf03605798 Mon Sep 17 00:00:00 2001 From: mitchell Date: Fri, 15 Dec 2023 11:01:56 -0500 Subject: [PATCH 2/2] Switch back to strfmt.DateTime in buildplanner structs. --- internal/runbits/requirements/requirements.go | 4 +++- internal/runners/initialize/init.go | 2 +- pkg/platform/model/buildplanner.go | 4 ++-- pkg/platform/runtime/buildexpression/buildexpression.go | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/runbits/requirements/requirements.go b/internal/runbits/requirements/requirements.go index 277092e56a..e3b19af226 100644 --- a/internal/runbits/requirements/requirements.go +++ b/internal/runbits/requirements/requirements.go @@ -28,6 +28,7 @@ import ( "github.com/ActiveState/cli/pkg/platform/model" "github.com/ActiveState/cli/pkg/platform/runtime/target" "github.com/ActiveState/cli/pkg/project" + "github.com/go-openapi/strfmt" "github.com/thoas/go-funk" ) @@ -243,6 +244,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation( } ts = &latest } + timestamp := strfmt.DateTime(*ts) // MUST ADDRESS: we're no longer passing bitwidth, but this needs it. Need to figure out why. requirementBitWidth := -1 @@ -265,7 +267,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation( RequirementVersion: requirements, RequirementNamespace: *ns, Operation: operation, - TimeStamp: ts, + TimeStamp: ×tamp, } bp := model.NewBuildPlannerModel(r.Auth) diff --git a/internal/runners/initialize/init.go b/internal/runners/initialize/init.go index 12ba69d66d..e04abe913b 100644 --- a/internal/runners/initialize/init.go +++ b/internal/runners/initialize/init.go @@ -251,7 +251,7 @@ func (r *Initialize) Run(params *RunParams) (rerr error) { Language: lang.Requirement(), Version: version, Private: params.Private, - Timestamp: timestamp, + Timestamp: strfmt.DateTime(timestamp), Description: locale.T("commit_message_add_initial"), }) if err != nil { diff --git a/pkg/platform/model/buildplanner.go b/pkg/platform/model/buildplanner.go index 95339e1d38..18a11603ce 100644 --- a/pkg/platform/model/buildplanner.go +++ b/pkg/platform/model/buildplanner.go @@ -225,7 +225,7 @@ type StageCommitParams struct { RequirementVersion []bpModel.VersionRequirement RequirementNamespace Namespace Operation bpModel.Operation - TimeStamp *time.Time + TimeStamp *strfmt.DateTime // ... or commits can have an expression (e.g. from pull). When pulling an expression, we do not // compute its changes into a series of above operations. Instead, we just pass the new // expression directly. @@ -329,7 +329,7 @@ type CreateProjectParams struct { Language string Version string Private bool - Timestamp time.Time + Timestamp strfmt.DateTime Description string Expr *buildexpression.BuildExpression } diff --git a/pkg/platform/runtime/buildexpression/buildexpression.go b/pkg/platform/runtime/buildexpression/buildexpression.go index aa453a9b1a..64a2e88886 100644 --- a/pkg/platform/runtime/buildexpression/buildexpression.go +++ b/pkg/platform/runtime/buildexpression/buildexpression.go @@ -872,7 +872,7 @@ func (e *BuildExpression) removePlatform(platformID strfmt.UUID) error { return nil } -func (e *BuildExpression) UpdateTimestamp(timestamp time.Time) error { +func (e *BuildExpression) UpdateTimestamp(timestamp strfmt.DateTime) error { formatted, err := time.Parse(time.RFC3339, timestamp.String()) if err != nil { return errs.Wrap(err, "Could not parse latest timestamp")