Skip to content

Commit

Permalink
Merge pull request #3349 from ActiveState/version/0-46-0-RC1
Browse files Browse the repository at this point in the history
Version 0.46.0-RC1
  • Loading branch information
Naatan authored Oct 11, 2024
2 parents 3a96eae + a09880c commit 6df75bd
Show file tree
Hide file tree
Showing 504 changed files with 12,831 additions and 26,556 deletions.
42 changes: 32 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
runs-on: ${{ matrix.sys.os }}
env:
ACTIVESTATE_CI: true
ACTIVESTATE_CLI_DISABLE_RUNTIME: true
SHELL: bash
GITHUB_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SHA_OVERRIDE: ${{ github.event.pull_request.head.sha || github.sha }}
Expand All @@ -69,7 +68,7 @@ jobs:

- # === Install Go ===
name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

Expand Down Expand Up @@ -393,20 +392,42 @@ jobs:

- # === Upload Session Artifacts ===
name: Upload Session Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: session-build-${{ matrix.sys.os }}
path: build/

scan:
name: Scan
needs:
- os_specific
runs-on: ubuntu-latest
steps:
- name: Download All Build Session Artifacts
uses: actions/download-artifact@v4
with:
path: build/
merge-multiple: true

- name: Scan for CVEs
if: runner.os == 'Linux'
uses: aquasecurity/[email protected]
with:
scan-type: rootfs
scan-ref: build
list-all-pkgs: true
ignore-unfixed: true
format: table
exit-code: 1

# === Deploy job (runs once with combined artifacts from OS specific job) ===
deploy:
name: Deploy
needs:
- os_specific
- scan
runs-on: ubuntu-20.04
env:
ACTIVESTATE_CI: true
ACTIVESTATE_CLI_DISABLE_RUNTIME: true
SHELL: bash
GITHUB_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SHA_OVERRIDE: ${{ github.event.pull_request.head.sha || github.sha }}
Expand All @@ -424,19 +445,20 @@ jobs:

- # === Install Go ===
name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
go-version: 1.22.x

- # === Install State Tool ===
name: Install State Tool
uses: ActiveState/setup-state-tool@v1

- # === Download All Build Session Artifacts ===
name: Download All Build Session Artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
path: build/
merge-multiple: true

- # === Sanitize All Session Artifacts ===
name: Sanitize All Session Artifacts
Expand Down Expand Up @@ -481,7 +503,7 @@ jobs:
- # === Cleanup Session Artifacts ===
name: Cleanup Session Artifacts
uses: geekyeggo/delete-artifact@v1
uses: geekyeggo/delete-artifact@v5
with:
name: |
session-build-ubuntu-20.04
Expand All @@ -490,7 +512,7 @@ jobs:
- # === Upload Artifacts ===
name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build
path: build/
4 changes: 2 additions & 2 deletions .github/workflows/propagate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:

- # === Checkout code ===
name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_AUTOMATION_TOKEN }}

- # === Install Go ===
name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '1.22.x'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- # Checkout Code
name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v5

- # === Install Go ===
name: Install Go
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- # === Install Go ===
name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '1.22.x'

Expand Down
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ linters-settings:
- (*github.com/ActiveState/cli/internal/testhelpers/e2e.SpawnedCmd).Wait
- (*github.com/ActiveState/cli/internal/testhelpers/e2e.Session).ClearCache
- (*github.com/ActiveState/cli/internal/testhelpers/e2e.Dirs).Close
- (*github.com/ActiveState/cli/pkg/platform/runtime/artifactcache.testArtifactCache).Store
- github.com/ActiveState/cli/internal/testhelpers/osutil.RemoveConfigFile
- (*github.com/ActiveState/cli/internal/logging.standardHandler).Emit
- (*github.com/ActiveState/cli/internal/logging.fileHandler).Emit
Expand Down
2 changes: 1 addition & 1 deletion activestate.generators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ scripts:
language: bash
description: Generates graph server and client files
value: |
go install github.com/99designs/[email protected].24
go install github.com/99designs/[email protected].46
cd ./cmd/state-svc && gqlgen --verbose
- name: generate-test-update
language: bash
Expand Down
12 changes: 6 additions & 6 deletions activestate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ scripts:
exit 1
fi
if ! type "golangci-lint" &> /dev/null; then
echo "golangci-lint was not found on your PATH, installing .."
echo "golangci-lint was not found on your PATH. Installing .."
go install github.com/golangci/golangci-lint/cmd/[email protected]
fi
git config core.hooksPath .githooks
if ! type "swagger" &> /dev/null; then
echo "swagger was not found on your PATH, installing .."
echo "swagger was not found on your PATH. Installing .."
go install github.com/go-swagger/go-swagger/cmd/[email protected]
fi
if ! type "actionlint" &> /dev/null; then
echo "actionlint was not found on your PATH, installing .."
echo "actionlint was not found on your PATH. Installing .."
go install github.com/rhysd/actionlint/cmd/[email protected]
fi
if { [[ "$GOOS" == "windows" ]] || [[ "$OS" == "Windows_NT" ]]; } && ! type "goversioninfo" &> /dev/null; then
echo "goversioninfo was not found on your PATH, installing .."
echo "goversioninfo was not found on your PATH. Installing .."
GOFLAGS="" go install github.com/josephspurrier/goversioninfo/cmd/[email protected]
fi
- name: install-deps-os
Expand All @@ -81,7 +81,7 @@ scripts:
if: ne .Shell "cmd"
value: |
if { [[ "$GOOS" == "windows" ]] || [[ "$OS" == "Windows_NT" ]]; } && ! type "goversioninfo" &> /dev/null; then
echo "goversioninfo was not found on your PATH, installing .."
echo "goversioninfo was not found on your PATH. Installing .."
GOFLAGS="" go install github.com/josephspurrier/goversioninfo/cmd/[email protected]
fi
- name: preprocess
Expand Down Expand Up @@ -319,7 +319,7 @@ scripts:
build/state --help
- name: debug
language: bash
description: "Runs a remote debugger, that can be hooked into from your IDE, example usage: `state run debug activate` (will debug `state activate`)"
description: "Runs a remote debugger that can be hooked into from your IDE. Example usage: `state run debug activate` (will debug `state activate`)"
standalone: true
value: dlv debug --headless --listen=:2346 --api-version=2 github.com/ActiveState/cli/cmd/state -- $@
- name: scripted
Expand Down
38 changes: 38 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,44 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.46.0

### Added

* Added the `state export buildplan` command, which as the name implies exports the buildplan for a project commit.
* We now show dependency and CVE information when running `state commit` and `state import`, just like we do for
`state install`.
* We now show CVE information when running `state checkout`.
* When working with complex buildscripts that use ingredient revisions or more complex build rules we will now report
on these in `state manifest`.
* We now support CycloneDX and SPDX SBOMs for `state import`.
* We now provide unstable support for powershell when running `state shell` and other commands that interact with the
shell.

### Changed

* Runtime installations will now use a central artifact depot, and will use symlinks on mac/linux and hardlinks on
windows to deploy them for your various runtime. Reducing disk usage, and increasing installation speeds.
* We may still copy instead of link artifacts if the artifact in question requires runtime specific modifications.
* Streamlined the UI for sourcing runtimes, it should now be consistent across commands.
* We now also show dependency information when updating requirements.
* When running `state export log` with the `-i` (index) flag we no longer consider logs for the current command.

### Fixed

* Running `state init` with a language version specific to the minor version would sometimes not resolve the language.
* `state manifest` would sometimes not show the resolved version.
* Missing CVE information for languages in `state manifest`.
* Uninstalling state tool would leave you in a broken state that required manual intervention if and when the uninstall
failed halfway through.
* We would sometimes redundantly show available update information.
* Uninstalling State Tool on Windows would leave behind start menu shortcuts.
* Progress indication when solving and creating a commit (eg. when running `state install`) would sometimes overlap.
* Made several improvements to dependency calculations, which should give user a more accurate picture of what
dependencies were brought in by a given change.
* This only affects UI/UX. It does not imply any build or runtime functionality.
* Many localization and error message improvements and additions to help guide users to solutions.

## 0.45.1

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion cmd/state-exec/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"path/filepath"
"strings"

"github.com/ActiveState/cli/pkg/platform/runtime/executors/execmeta"
"github.com/ActiveState/cli/pkg/executors/execmeta"
)

const (
Expand Down
19 changes: 16 additions & 3 deletions cmd/state-installer/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func main() {
var err error
cfg, err = config.New()
if err != nil {
multilog.Error("Could not set up configuration handler: " + errs.JoinMessage(err))
multilog.Critical("Could not set up configuration handler: " + errs.JoinMessage(err))
fmt.Fprintln(os.Stderr, err.Error())
exitCode = 1
}
Expand All @@ -108,7 +108,7 @@ func main() {
Interactive: false,
})
if err != nil {
multilog.Error("Could not set up output handler: " + errs.JoinMessage(err))
multilog.Critical("Could not set up output handler: " + errs.JoinMessage(err))
fmt.Fprintln(os.Stderr, err.Error())
exitCode = 1
return
Expand Down Expand Up @@ -148,7 +148,7 @@ func main() {
"state-installer",
"",
"Installs or updates the State Tool",
primer.New(nil, out, nil, nil, nil, nil, cfg, nil, nil, an),
primer.New(out, cfg, an),
[]*captain.Flag{ // The naming of these flags is slightly inconsistent due to backwards compatibility requirements
{
Name: "command",
Expand Down Expand Up @@ -251,6 +251,8 @@ func execute(out output.Outputer, cfg *config.Instance, an analytics.Dispatcher,

an.Event(anaConst.CatInstallerFunnel, "exec")

usingDefaultInstallPath := params.path == ""

if params.path == "" {
var err error
params.path, err = installation.InstallPathForChannel(constants.ChannelName)
Expand Down Expand Up @@ -296,6 +298,17 @@ func execute(out output.Outputer, cfg *config.Instance, an analytics.Dispatcher,
return errs.Wrap(err, "Could not check if install path is empty")
}
if !empty {
if usingDefaultInstallPath {
// We're having trouble pinning down why these errors are occurring, so report the list of
// existing files to Rollbar to help diagnose.
if files, err := os.ReadDir(params.path); err == nil {
fileList := []string{}
for _, file := range files {
fileList = append(fileList, filepath.Join(params.path, file.Name()))
}
rollbar.Critical("Installation path must be an empty directory: %s\nExisting files:\n%s", params.path, strings.Join(fileList, "\n"))
}
}
return locale.NewInputError("err_install_nonempty_dir", "Installation path must be an empty directory: {{.V0}}", params.path)
}
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/state-installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,13 @@ func installedOnPath(installRoot, channel string) (bool, string, error) {

// Check for state.exe in channel, root and bin dir
// This is to handle older state tool versions that gave incompatible input paths
// Also, fall back on checking for the install dir marker in case of a failed uninstall attempt.
candidates := []string{
filepath.Join(installRoot, channel, installation.BinDirName, stateCmd),
filepath.Join(installRoot, channel, stateCmd),
filepath.Join(installRoot, installation.BinDirName, stateCmd),
filepath.Join(installRoot, stateCmd),
filepath.Join(installRoot, installation.InstallDirMarker),
}
for _, candidate := range candidates {
if fileutils.TargetExists(candidate) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/state-installer/test/integration/installer_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (suite *InstallerIntegrationTestSuite) TestInstallErrorTips() {
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
)

cp.ExpectInput()
cp.ExpectInput(e2e.RuntimeSourcingTimeoutOpt)
cp.SendLine("state command-does-not-exist")
cp.ExpectInput()
cp.SendLine("exit")
Expand Down
5 changes: 4 additions & 1 deletion cmd/state-remote-installer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func main() {
"state-installer",
"",
"Installs or updates the State Tool",
primer.New(nil, out, nil, nil, nil, nil, cfg, nil, nil, an),
primer.New(out, cfg, an),
[]*captain.Flag{ // The naming of these flags is slightly inconsistent due to backwards compatibility requirements
{
Name: "channel",
Expand Down Expand Up @@ -216,6 +216,9 @@ func execute(out output.Outputer, prompt prompt.Prompter, cfg *config.Instance,
if params.nonInteractive {
args = append(args, "-n") // forward to installer
}
if params.force {
args = append(args, "--force") // forward to installer
}
env := []string{
constants.InstallerNoSubshell + "=true",
}
Expand Down
7 changes: 5 additions & 2 deletions cmd/state-svc/internal/rtwatcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rtwatcher

import (
"encoding/json"
"errors"
"os"
"runtime/debug"
"strconv"
Expand Down Expand Up @@ -81,7 +82,8 @@ func (w *Watcher) check() {
for i := range w.watching {
e := w.watching[i] // Must use index, because we are deleting indexes further down
running, err := e.IsRunning()
if err != nil && !errs.Matches(err, &processError{}) {
var errProcess *processError
if err != nil && !errors.As(err, &errProcess) {
multilog.Error("Could not check if runtime process is running: %s", errs.JoinMessage(err))
// Don't return yet, the conditional below still needs to clear this entry
}
Expand Down Expand Up @@ -110,7 +112,8 @@ func (w *Watcher) GetProcessesInUse(execDir string) []entry {
continue
}
isRunning, err := proc.IsRunning()
if err != nil && !errs.Matches(err, &processError{}) {
var errProcess *processError
if err != nil && !errors.As(err, &errProcess) {
multilog.Error("Could not check if runtime process is running: %s", errs.JoinMessage(err))
// Any errors should not affect fetching which processes are currently in use. We just won't
// include this one in the list.
Expand Down
4 changes: 2 additions & 2 deletions cmd/state-svc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func main() {
cfg, err = config.New()
if err != nil {
multilog.Critical("Could not initialize config: %v", errs.JoinMessage(err))
fmt.Fprintf(os.Stderr, "Could not load config, if this problem persists please reinstall the State Tool. Error: %s\n", errs.JoinMessage(err))
fmt.Fprintf(os.Stderr, "Could not load config. If this problem persists please reinstall the State Tool. Error: %s\n", errs.JoinMessage(err))
exitCode = 1
return
}
Expand Down Expand Up @@ -115,7 +115,7 @@ func run(cfg *config.Instance) error {
return runStart(out, "svc-start:mouse")
}

p := primer.New(nil, out, nil, nil, nil, nil, cfg, nil, nil, an)
p := primer.New(out, cfg, an)

showVersion := false
cmd := captain.NewCommand(
Expand Down
Loading

0 comments on commit 6df75bd

Please sign in to comment.