Skip to content

Commit

Permalink
Merge pull request #2673 from ActiveState/version/0-42-0-RC1
Browse files Browse the repository at this point in the history
Version 0.42.0-RC1
  • Loading branch information
MDrakos authored Nov 15, 2023
2 parents 3208ddd + cf23338 commit facdbbb
Show file tree
Hide file tree
Showing 745 changed files with 83,002 additions and 23,948 deletions.
Empty file.
Binary file removed .github/deps/Linux/bin/state
Binary file not shown.
Binary file removed .github/deps/Linux/bin/state-svc
Binary file not shown.
Empty file.
Binary file removed .github/deps/Windows/bin/state-svc.exe
Binary file not shown.
Binary file removed .github/deps/Windows/bin/state.exe
Binary file not shown.
Empty file.
Binary file removed .github/deps/macOS/bin/state
Binary file not shown.
Binary file removed .github/deps/macOS/bin/state-svc
Binary file not shown.
28 changes: 22 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ name: Build-Test-Deploy
- synchronize
- reopened
schedule:
-
cron: 0 0 * * *
- cron: 0 0 * * *

# === Workflow Permissions ===
permissions:
Expand All @@ -25,7 +24,7 @@ permissions:

# === Workflow-level environment variables ===
env:
AWS_REGION : us-east-1
AWS_REGION: us-east-1
AWS_ROLE_SESSION_NAME: gha-activestate-cli

# === JOBS ===
Expand Down Expand Up @@ -56,6 +55,11 @@ jobs:

# === OS Specific Steps ===
steps:
- # === Disable Windows Defender as it slows things down significantly ===
name: Disabling Windows Defender
if: runner.os == 'Windows'
shell: powershell
run: Set-MpPreference -DisableRealtimeMonitoring $true

- # === Checkout Code ===
name: Checkout code
Expand All @@ -73,6 +77,10 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}

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

- # === Setup ===
name: Setup
shell: bash
Expand Down Expand Up @@ -243,7 +251,7 @@ jobs:
name: Generate Remote Install Deployment
shell: bash
run: state run generate-remote-install-deployment

- # === Configure AWS credentials ==
name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
Expand Down Expand Up @@ -314,14 +322,13 @@ jobs:
echo "Running integration tests with tags: $TEST_SUITE_TAGS (empty means every test not specifically tagged)"
export TEST_SUITE_TAGS="$TEST_SUITE_TAGS"
TIMEOUT=15m
TIMEOUT=30m
if [[ "$TEST_SUITE_TAGS" == "all" ]]; then
TIMEOUT=60m
fi
SHELL='' go test -timeout $TIMEOUT -v `go list ./... | grep "integration"` -json 2>&1 | gotestfmt -hide empty-packages
continue-on-error: ${{ github.event_name == 'schedule' }}
env:
ACTIVESTATE_VERBOSE: true
INTEGRATION_TEST_USERNAME: ${{ secrets.INTEGRATION_TEST_USERNAME }}
INTEGRATION_TEST_PASSWORD: ${{ secrets.INTEGRATION_TEST_PASSWORD }}
INTEGRATION_TEST_TOKEN: ${{ secrets.INTEGRATION_TEST_TOKEN }}
Expand Down Expand Up @@ -409,6 +416,10 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

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

- # === Setup ===
name: Setup
shell: bash
Expand Down Expand Up @@ -458,6 +469,11 @@ jobs:
aws-region: ${{ env.AWS_REGION }}
mask-aws-account-id: true

- # === Generate updated master versions.json if necessary ===
name: Generate version list
shell: bash
run: state run generate-versions-list

- # === Deploy ===
name: Deploy
shell: bash
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/propagate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

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

- # === Setup ===
name: Setup
shell: bash
Expand Down Expand Up @@ -85,6 +89,13 @@ jobs:
"type": "mrkdwn",
"text": "Propagate-PR failed for *<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>*\nFailure should be addressed by *${{ github.event.pull_request.user.login }}*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Failed job: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

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

- # === Setup ===
name: Setup
shell: bash
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
with:
go-version: '1.20.x'

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

- # === Setup ===
name: Setup
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ linters-settings:
- (*github.com/ActiveState/termtest.ConsoleProcess).ExpectExitCode
- (*github.com/ActiveState/termtest.ConsoleProcess).ExpectNotExitCode
- (*github.com/ActiveState/termtest.ConsoleProcess).ExpectRe
- (*github.com/ActiveState/termtest.ConsoleProcess).ExpectLongString
- (*github.com/ActiveState/termtest.ConsoleProcess).Expect
- (*github.com/ActiveState/termtest.ConsoleProcess).WaitForInput

# When issues occur with linting us the snippet below to help with debugging
Expand All @@ -23,4 +23,4 @@ linters-settings:
# - ineffassign
# - staticcheck
# - typecheck
# - unused
# - unused
11 changes: 10 additions & 1 deletion activestate.generators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ scripts:
value: |
set -e
$constants.SET_ENV
echo "# Generate payload"
go run ./scripts/ci/payload-generator/main.go "$@"
- name: generate-update
Expand Down Expand Up @@ -120,3 +120,12 @@ scripts:
go run scripts/ci/payload-generator/main.go -b ${TEST_CHANNEL} -v ${TEST_VERSION}
copy_test_payload
go run scripts/ci/update-generator/main.go -b ${TEST_CHANNEL} -v ${TEST_VERSION} -o ${TEST_ARCHIVE_DIR}
- name: generate-versions-list
language: bash
standalone: true
description: Generates master versions.json from S3 and info.json's from generate-update
value: |
set -e
$constants.SET_ENV
go run scripts/ci/update-version-list/main.go ./build/update
53 changes: 53 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,59 @@ 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.42.0

### Added
* The State Tool now has better user-facing errors. These should provide more context
and actionable information when an error occurs. Currently, this is only implemented
on a subset of commands, but will be expanded to all commands in the future.
* The State Tool now fully supports Ruby as a language.
* Users can now install their runtime with all of the build dependencies by using
the `ACTIVESTATE_INSTALL_BUILD_DEPENDENCIES` environment variable.
* Users can now install a specific version of the State Tool by passing the version
to the installer script without the SHA suffix. Previously, users would have to
know the SHA of the version they wanted to install.

### Changed

* `state init` now uses the new buildplanner API to create a project on the
platform.
* Runtime counts and limits are no longer surfaced to the user.
* `state revert` now uses the new buildplanner API to revert a previous commit
as well as revert to a specific commit using `state revert --to`.
* `state pull` now uses the buildplanner API to merge changes from the platform
into the local project.
* We no longer depend on the `file` utility when installing the State Tool. This
should make the installation process more reliable.
* Updated detection for requirement changes when installing packages. This brings
the installation process in line with new APIs and should make the process more
reliable.
* Update checks have been moved to the `state-svc`. This should speed up State
Tool execution and improve the reliability of the update process.

### Removed

* Support for headless commits has been removed. Users can no longer get into a
state where they have a headless commit. Existing projects that are headless
will now be prompted to convert their project before it can be used.
* The State Tool no longer supports signup via the prompt. Users may still sign
up with `state signup` however this will open the signup page in their
browser.

### Fixed

* Fixed an issue where the `state-svc` log file path was not being presented
correctly in the `state-svc status` output.
* Fixed an issue where the version number could be empty when running
`state update` and no update is available.
* Fixed an issue where executors would halt on most CI systems.
* The install scripts now verify the checksum of the downloaded archive before
extracting it even when a full version is provided as a flag.
* Fixed unneccessary repetition of certain error tips.
* The commit date has been fixed when running `state history`.
* Fixed an issue where the commit message would be missing on some commits when
running `state history`.

### 0.41.0

### Added
Expand Down
6 changes: 3 additions & 3 deletions cmd/state-exec/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os/exec"
)

func runCmd(meta *executorMeta) error {
func runCmd(meta *executorMeta) (int, error) {
userArgs := os.Args[1:]
cmd := exec.Command(meta.MatchingBin, userArgs...)
cmd.Stdin = os.Stdin
Expand All @@ -15,8 +15,8 @@ func runCmd(meta *executorMeta) error {
cmd.Env = meta.TransformedEnv

if err := cmd.Run(); err != nil {
return fmt.Errorf("command %q failed: %w", meta.MatchingBin, err)
return -1, fmt.Errorf("command %q failed: %w", meta.MatchingBin, err)
}

return nil
return cmd.ProcessState.ExitCode(), nil
}
4 changes: 2 additions & 2 deletions cmd/state-exec/comm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const (
msgWidth = 1024
)

func sendMsgToService(sockPath string, hb *svcmsg.Heartbeat) error {
func sendMsgToService(sockPath string, msg svcmsg.Messager) error {
conn, err := net.Dial(network, sockPath)
if err != nil {
return fmt.Errorf("dial failed: %w", err)
}
defer conn.Close()

_, err = conn.Write([]byte(hb.SvcMsg()))
_, err = conn.Write([]byte(msg.SvcMsg()))
if err != nil {
return fmt.Errorf("write to connection failed: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/state-exec/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import "os"

// onCI is copied from the internal/condition package (to minimize depdencies).
func onCI() bool {
return os.Getenv("CI") != "" || os.Getenv("BUILDER_OUTPUT") != ""
// inActiveStateCI is copied from the internal/condition package (to minimize dependencies).
func inActiveStateCI() bool {
return os.Getenv("ACTIVESTATE_CI") == "true"
}
17 changes: 17 additions & 0 deletions cmd/state-exec/exitcode.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import (
"fmt"
"os"
"strconv"

"github.com/ActiveState/cli/internal/svcctl/svcmsg"
)

func newExitCodeMessage(exitCode int) (*svcmsg.ExitCode, error) {
execPath, err := os.Executable()
if err != nil {
return nil, fmt.Errorf("cannot get executable info: %w", err)
}
return &svcmsg.ExitCode{execPath, strconv.Itoa(exitCode)}, nil
}
19 changes: 17 additions & 2 deletions cmd/state-exec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,31 @@ func run() error {
if err := sendMsgToService(meta.SockPath, hb); err != nil {
logr.Debug(" sock - error: %v", err)

if onCI() { // halt control flow on CI only
if inActiveStateCI() { // halt control flow on CI only
return fmt.Errorf("cannot send message to service (this error is handled in CI only): %w", err)
}
}

logr.Debug("cmd - running: %s", meta.MatchingBin)
if err := runCmd(meta); err != nil {
exitCode, err := runCmd(meta)
if err != nil {
logr.Debug(" running - failed: bins (%v)", meta.ExecMeta.Bins)
return fmt.Errorf("cannot run command: %w", err)
}

msg, err := newExitCodeMessage(exitCode)
if err != nil {
return fmt.Errorf("cannot create new exit code message: %w", err)
}
logr.Debug("message data - exec: %s, exit code: %s", msg.ExecPath, msg.ExitCode)

if err := sendMsgToService(meta.SockPath, msg); err != nil {
logr.Debug(" sock - error: %v", err)

if inActiveStateCI() { // halt control flow on CI only
return fmt.Errorf("cannot send message to service (this error is handled in CI only): %w", err)
}
}

return nil
}
13 changes: 13 additions & 0 deletions cmd/state-installer/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@ func main() {
logging.Debug("Original Args: %v", os.Args)
logging.Debug("Processed Args: %v", processedArgs)

// Store sessionToken to config
for _, envVar := range []string{constants.OverrideSessionTokenEnvVarName, constants.SessionTokenEnvVarName} {
sessionToken, ok := os.LookupEnv(envVar)
if !ok {
continue
}
err := cfg.Set(anaConst.CfgSessionToken, sessionToken)
if err != nil {
multilog.Error("Unable to set session token: " + errs.JoinMessage(err))
}
break
}

an = sync.New(anaConst.SrcStateInstaller, cfg, nil, out)
an.Event(anaConst.CatInstallerFunnel, "start")

Expand Down
Loading

0 comments on commit facdbbb

Please sign in to comment.