Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dashboard build progress details URL. #3590

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/constants/constants.go
Original file line number Diff line number Diff line change
@@ -493,3 +493,6 @@ const OverrideShellEnvVarName = "ACTIVESTATE_CLI_SHELL_OVERRIDE"

// IgnoreEnvEnvVarName is the environment variable to set for skipping specific environment variables during runtime setup.
const IgnoreEnvEnvVarName = "ACTIVESTATE_CLI_IGNORE_ENV"

// ProgressUrlPathName is the trailing path for a project's build progress.
const BuildProgressUrlPathName = "distributions"
4 changes: 3 additions & 1 deletion internal/locale/locales/en-us.yaml
Original file line number Diff line number Diff line change
@@ -1127,7 +1127,9 @@ progress_solve_preruntime:
progress_pkg_nolang:
other: "• Searching for [ACTIONABLE]{{.V0}}[/RESET] across all languages in the ActiveState Catalog"
progress_build_log:
other: "Build Log [ACTIONABLE]{{.V0}}[/RESET]"
other: "Build Log: [ACTIONABLE]{{.V0}}[/RESET]"
progress_build_url:
other: "Detailed Progress: [ACTIONABLE]{{.V0}}[/RESET]"
progress_completed:
other: "[SUCCESS]✔ All dependencies have been installed and verified[/RESET]"
progress_failed:
1 change: 1 addition & 0 deletions internal/runbits/runtime/progress/progress.go
Original file line number Diff line number Diff line change
@@ -147,6 +147,7 @@ func (p *ProgressDigester) Handle(ev events.Event) error {
// already progressbars being displayed which won't play nice with newly printed output.
if v.RequiresBuild {
p.out.Notice(locale.Tr("progress_build_log", v.LogFilePath))
p.out.Notice(locale.Tr("progress_build_url", v.ProgressUrl))
}

p.recipeID = v.RecipeID
19 changes: 19 additions & 0 deletions internal/runbits/runtime/runtime.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package runtime_runbit

import (
"net/url"
"os"

anaConsts "github.com/ActiveState/cli/internal/analytics/constants"
@@ -252,6 +253,24 @@ func Update(
if opts.Archive != nil {
rtOpts = append(rtOpts, runtime.WithArchive(opts.Archive.Dir, opts.Archive.PlatformID, checkout.ArtifactExt))
}
if commit.BuildPlan().IsBuildInProgress() {
// Build progress URL is of the form
// https://<host>/<owner>/<project>/distributions?branch=<branch>&commitID=<commitID>
host := constants.DefaultAPIHost
if hostOverride := os.Getenv(constants.APIHostEnvVarName); hostOverride != "" {
host = hostOverride
}
path, err := url.JoinPath(proj.Owner(), proj.Name(), constants.BuildProgressUrlPathName)
if err != nil {
return nil, errs.Wrap(err, "Could not construct progress url path")
}
u := &url.URL{Scheme: "https", Host: host, Path: path}
q := u.Query()
q.Set("branch", proj.BranchName())
q.Set("commitID", commitID.String())
u.RawQuery = q.Encode()
rtOpts = append(rtOpts, runtime.WithBuildProgressUrl(u.String()))
}

if err := rt.Update(buildPlan, rtHash, rtOpts...); err != nil {
return nil, locale.WrapError(err, "err_packages_update_runtime_install")
1 change: 1 addition & 0 deletions pkg/runtime/events/events.go
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ type Start struct {

RequiresBuild bool
LogFilePath string
ProgressUrl string

ArtifactsToBuild buildplan.ArtifactIDMap
ArtifactsToDownload buildplan.ArtifactIDMap
4 changes: 4 additions & 0 deletions pkg/runtime/options.go
Original file line number Diff line number Diff line change
@@ -13,6 +13,10 @@ func WithBuildlogFilePath(path string) SetOpt {
return func(opts *Opts) { opts.BuildlogFilePath = path }
}

func WithBuildProgressUrl(url string) SetOpt {
return func(opts *Opts) { opts.BuildProgressUrl = url }
}

func WithPreferredLibcVersion(version string) SetOpt {
return func(opts *Opts) { opts.PreferredLibcVersion = version }
}
2 changes: 2 additions & 0 deletions pkg/runtime/setup.go
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ type Opts struct {
PreferredLibcVersion string
EventHandlers []events.HandlerFunc
BuildlogFilePath string
BuildProgressUrl string

FromArchive *fromArchive

@@ -200,6 +201,7 @@ func (s *setup) RunAndWait() (rerr error) {
RecipeID: s.buildplan.LegacyRecipeID(),
RequiresBuild: s.buildplan.IsBuildInProgress() && len(s.toDownload) > 0,
LogFilePath: s.opts.BuildlogFilePath,
ProgressUrl: s.opts.BuildProgressUrl,
ArtifactsToBuild: s.toBuild,
ArtifactsToDownload: s.toDownload,
ArtifactsToUnpack: s.toUnpack,
3 changes: 2 additions & 1 deletion test/integration/runtime_int_test.go
Original file line number Diff line number Diff line change
@@ -169,7 +169,8 @@ func (suite *RuntimeIntegrationTestSuite) TestBuildInProgress() {
ts.PrepareEmptyProject()

cp = ts.Spawn("install", "private/"+e2e.PersistentUsername+"/hello-world", "--ts", "now")
cp.Expect("Build Log")
cp.Expect("Build Log:")
cp.Expect("Detailed Progress:")
cp.Expect("Building")
cp.Expect("All dependencies have been installed and verified", e2e.RuntimeBuildSourcingTimeoutOpt)
cp.Expect("Added: private/" + e2e.PersistentUsername + "/hello-world")
Loading