Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
name: Docs
# Community fork: automatic docs deployment is disabled; run manually if needed.
on:
push:
branches:
- main
- test-docs-generator # for testing
# Update version in installation instructions when new version is released
release:
types:
- released
workflow_dispatch:

permissions:
contents: read
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
name: Examples

# Community fork: the examples run is slow and creates billable resources; run manually only.
on:
pull_request:
paths:
- ".github/workflows/examples.yml"
- "**.go"
- "go.mod"
- "go.sum"
- "examples/**.md"
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -39,8 +33,7 @@ jobs:
version: 'latest'
- name: Test examples
env:
UPCLOUD_USERNAME: ${{ secrets.UPCLOUD_USERNAME }}
UPCLOUD_PASSWORD: ${{ secrets.UPCLOUD_PASSWORD }}
UPCLOUD_TOKEN: ${{ secrets.UPCLOUD_TOKEN }}
run: |
upctl version
upctl account show > /dev/null # Ensure that credentials are valid
Expand All @@ -60,8 +53,7 @@ jobs:
- name: Install upctl
uses: UpCloudLtd/upcloud-cli-action@7e373972e386da6ef8c8336be8a855bafeafcbc8 # v1.0.2
with:
username: ${{ secrets.UPCLOUD_USERNAME }}
password: ${{ secrets.UPCLOUD_PASSWORD }}
token: ${{ secrets.UPCLOUD_TOKEN }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Purge resources
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
- '.github/workflows/lint.yml'
- '.golangci.yaml'
- '.tool-versions'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
jobs:
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ jobs:
# uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: DockerHub Login
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: GitHub Container Registry Login
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
Expand All @@ -51,7 +46,6 @@ jobs:
args: release --clean --release-notes=.release_notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
- name: Clear Docker login session
run: rm -f ${HOME}/.docker/config.json
- name: Capture dist checksums in an output string
Expand All @@ -63,27 +57,6 @@ jobs:
echo "EOF"
} >>"$GITHUB_OUTPUT"

aur:
name: AUR
runs-on: ubuntu-latest
needs:
- publish_release
steps:
- name: Checkout head
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Generate AUR PKGBUILD
run: ./scripts/generate_aur_pkgbuild.sh ${{ github.ref_name }}
- name: Publish AUR package
uses: KSXGitHub/github-actions-deploy-aur@da03e160361ce01bf087e790b6ffd196d7dccff7 # v4.1.3
with:
pkgname: upcloud-cli
pkgbuild: PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Release ${{ github.ref_name }}
force_push: true

attest:
name: Attest
needs:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
- '**.go'
- 'go.mod'
- 'go.sum'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
jobs:
Expand Down
25 changes: 10 additions & 15 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ brews:
repository:
owner: UpCloudLtd
name: homebrew-tap

# Optionally a token can be provided, if it differs from the token provided to GoReleaser
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
commit_author:
name: goreleaserbot
email: goreleaser@carlosbecker.com
Expand All @@ -124,7 +121,8 @@ brews:
# If set to auto, the release will not be uploaded to the homebrew tap
# in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1
# Default is false.
skip_upload: false
# Community fork: never publish to the upstream tap.
skip_upload: true

# Custom block for brew.
# Can be used to specify alternate downloads for devel or head releases.
Expand Down Expand Up @@ -156,21 +154,17 @@ dockers:
use: buildx
dockerfile: Dockerfile.goreleaser
image_templates:
- "upcloud/upctl:latest"
- "upcloud/upctl:{{ .Tag }}"
- "upcloud/upctl:{{ .Major }}"
- "upcloud/upctl:{{ .Major }}.{{ .Minor }}"
- "ghcr.io/upcloudltd/upctl:latest"
- "ghcr.io/upcloudltd/upctl:{{ .Tag }}"
- "ghcr.io/upcloudltd/upctl:{{ .Major }}"
- "ghcr.io/upcloudltd/upctl:{{ .Major }}.{{ .Minor }}"
- "ghcr.io/upcloud-tools/upctl:latest"
- "ghcr.io/upcloud-tools/upctl:{{ .Tag }}"
- "ghcr.io/upcloud-tools/upctl:{{ .Major }}"
- "ghcr.io/upcloud-tools/upctl:{{ .Major }}.{{ .Minor }}"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title=upctl"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source=https://github.com/UpCloudLtd/upcloud-cli.git"
- "--label=org.opencontainers.image.source=https://github.com/upcloud-tools/upcloud-cli.git"

sboms:
- documents:
Expand All @@ -180,7 +174,7 @@ release:
# Repo in which the release will be created.
# Default is extracted from the origin remote URL or empty if its private hosted.
github:
owner: UpCloudLtd
owner: upcloud-tools
name: upcloud-cli

# If set to true, will not auto-publish the release.
Expand All @@ -202,7 +196,8 @@ release:
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
# If set to true, will mark the release as not ready for production.
# Default is false.
prerelease: false
# Community fork: -community tags are semver prereleases.
prerelease: auto

# What to do with the release notes in case there the release already exists.
#
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.37.1-community] - 2026-11-15

### Changed

- `kubernetes nodegroup scale` uses the v9 SDK. Its existing JSON and YAML output shape is preserved.
- Command help no longer shows a default value for required flags, such as `kubernetes nodegroup scale --count`.

### Fixed

- Fix `kubernetes nodegroup scale --count 0` silently doing nothing. The node count is now always sent to the API, so node groups can be scaled down to zero.

## [3.37.0] - 2026-10-13

### Added
Expand Down Expand Up @@ -754,7 +765,8 @@ Initial public beta release :tada:
### Added
- Current feature set added! First internal release

[Unreleased]: https://github.com/UpCloudLtd/upcloud-cli/compare/v3.37.0...HEAD
[Unreleased]: https://github.com/upcloud-tools/upcloud-cli/compare/v3.37.1-community...HEAD
[3.37.1-community]: https://github.com/upcloud-tools/upcloud-cli/compare/v3.37.0...v3.37.1-community
[3.37.0]: https://github.com/UpCloudLtd/upcloud-cli/compare/v3.36.0...v3.37.0
[3.36.0]: https://github.com/UpCloudLtd/upcloud-cli/compare/v3.35.0...v3.36.0
[3.35.0]: https://github.com/UpCloudLtd/upcloud-cli/compare/v3.34.0...v3.35.0
Expand Down
49 changes: 49 additions & 0 deletions FORK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Community fork

This repository is an independent community fork of [UpCloudLtd/upcloud-cli](https://github.com/UpCloudLtd/upcloud-cli).
It tracks upstream releases and carries fixes that have not (yet) been merged upstream.
Changes are kept small and self-contained so that upstream can merge them at any time.

## Versioning

- Fork releases are always suffixed with `-community`, e.g. `3.37.1-community` (git tag `v3.37.1-community`).
- The base version is the upstream release the fork is synced to; fork-only changes bump the patch (or minor) component on top of it.
- Like upstream, the binary version is derived from the git tag at build time (goreleaser injects it into `internal/config.Version`); release preparation only updates `CHANGELOG.md`.
- Compare links for `-community` versions point to this fork; links for upstream versions point to UpCloudLtd/upcloud-cli.

## Feature parity

**Base: upstream v3.37.0 (2026-10-13).** The fork contains all upstream features; no upstream feature is removed or disabled.

### Fork-only changes

| Change | Introduced in | Related issue | Upstream status |
| ------ | ------------- | ------------- | --------------- |
| `kubernetes node-group scale --count 0` sends `{"count": 0}` instead of silently doing nothing. The command now uses the v9 SDK; JSON/YAML output shape is preserved. | 3.37.1-community | [#1](https://github.com/upcloud-tools/upcloud-cli/issues/1) | Not fixed as of upstream v3.37.0 |
| Command help no longer shows `Default:` for required flags (e.g. `scale --count` showed a misleading `Default: 0`). | 3.37.1-community | [#1](https://github.com/upcloud-tools/upcloud-cli/issues/1) | Not fixed as of upstream v3.37.0 |

### Notes for upstream merging

- The scale fix works around a bug in the `upcloud-go-api` v8 SDK: `request.ModifyKubernetesNodeGroup.Count` is tagged `json:"count,omitempty"`, so a zero count is dropped from the PATCH body and the API no-ops while the CLI reports success. The v9 SDK (`KubernetesNodeGroupPatch`) models `count` without `omitempty` and is not affected. Fixing the v8 SDK would additionally benefit all other v8 consumers.
- The help renderer change is in `internal/ui/usage.go` (`formatFlags`) and applies to every command with required flags.

## CI and releases

The fork runs the upstream workflows with a release pipeline adapted for the fork:

- `test`, `lint`, `codeql`: run as upstream, no secrets needed. Superseded runs on the same PR or branch are cancelled automatically.
- `docs`: manual `workflow_dispatch` only here. Upstream deploys the MkDocs site to `gh-pages` on main pushes and releases; run it manually and enable GitHub Pages if you want the site.
- `examples`: manual `workflow_dispatch` only here. Run when necessary, as it creates billable resources.
- `publish`: on tags matching `v*.*.*` (e.g. `v3.37.1-community`), builds binaries, deb/rpm/apk packages, checksums, and SBOMs, creates a **draft** GitHub release on this fork (marked as prerelease for `-community` tags), pushes container images to `ghcr.io/upcloud-tools/upctl`, and attaches build provenance attestations. Publish the draft release manually after review.

Differences from upstream: no Docker Hub (`upcloud/upctl`), or Homebrew tap publishing. Everything else uses the automatic `GITHUB_TOKEN`; no additional secrets are needed for releases.

## Syncing with upstream

```sh
git remote add upstream git@github.com:UpCloudLtd/upcloud-cli.git
git fetch upstream
git merge upstream/main
```

After syncing: update the base version above, drop fork-only changes that upstream merged from the table, and base the next `-community` version on the new upstream release.
74 changes: 74 additions & 0 deletions internal/commands/kubernetes/nodegroup/fakeapi_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package nodegroup

import (
"io"
"net/http"
"net/http/httptest"
"net/url"
"sync"
"testing"

upcloudv9 "github.com/UpCloudLtd/upcloud-go-api/v9/pkg/upcloud"
"github.com/stretchr/testify/require"
)

type apiRequest struct {
Method string
Path string
Query url.Values
Body []byte
}

type fakeResponse struct {
status int
body string
contentType string
}

// fakeAPI serves canned responses keyed by "METHOD /path" and records every request.
type fakeAPI struct {
mu sync.Mutex
requests []apiRequest
client *upcloudv9.ClientWithResponses
}

func newFakeAPI(t *testing.T, responses map[string]fakeResponse) *fakeAPI {
t.Helper()
api := &fakeAPI{}
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, err := io.ReadAll(r.Body)
if err != nil {
t.Errorf("reading request body: %v", err)
}
key := r.Method + " " + r.URL.Path
api.mu.Lock()
api.requests = append(api.requests, apiRequest{Method: r.Method, Path: r.URL.Path, Query: r.URL.Query(), Body: body})
api.mu.Unlock()

res, ok := responses[key]
if !ok {
t.Errorf("unexpected request %s", key)
w.WriteHeader(http.StatusInternalServerError)
return
}
contentType := res.contentType
if contentType == "" {
contentType = "application/json"
}
w.Header().Set("Content-Type", contentType)
w.WriteHeader(res.status)
_, _ = io.WriteString(w, res.body)
}))
t.Cleanup(server.Close)

client, err := upcloudv9.NewClientWithResponses(server.URL)
require.NoError(t, err)
api.client = client
return api
}

func (a *fakeAPI) all() []apiRequest {
a.mu.Lock()
defer a.mu.Unlock()
return append([]apiRequest(nil), a.requests...)
}
Loading
Loading