Skip to content

Commit 0492dca

Browse files
authored
Merge branch 'main' into yg/onboard-intake
2 parents 4dce577 + a941843 commit 0492dca

File tree

772 files changed

+17920
-22123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

772 files changed

+17920
-22123
lines changed

.github/docs/contribution-guide/client.go

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,12 @@ package client
22

33
import (
44
"github.com/spf13/viper"
5-
"github.com/stackitcloud/stackit-cli/internal/pkg/auth"
6-
"github.com/stackitcloud/stackit-cli/internal/pkg/config"
7-
"github.com/stackitcloud/stackit-cli/internal/pkg/errors"
5+
genericclient "github.com/stackitcloud/stackit-cli/internal/pkg/generic-client"
86
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
9-
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
10-
sdkConfig "github.com/stackitcloud/stackit-sdk-go/core/config"
117
"github.com/stackitcloud/stackit-sdk-go/services/foo"
128
// (...)
139
)
1410

1511
func ConfigureClient(p *print.Printer, cliVersion string) (*foo.APIClient, error) {
16-
authCfgOption, err := auth.AuthenticationConfig(p, auth.AuthorizeUser)
17-
if err != nil {
18-
return nil, &errors.AuthError{}
19-
}
20-
21-
region := viper.GetString(config.RegionKey)
22-
cfgOptions := []sdkConfig.ConfigurationOption{
23-
utils.UserAgentConfigOption(cliVersion),
24-
sdkConfig.WithRegion(region), // Configuring region is needed if "foo" is a regional API
25-
authCfgOption,
26-
}
27-
28-
customEndpoint := viper.GetString(config.fooCustomEndpointKey)
29-
30-
if customEndpoint != "" {
31-
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
32-
}
33-
34-
if p.IsVerbosityDebug() {
35-
cfgOptions = append(cfgOptions,
36-
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
37-
)
38-
}
39-
40-
apiClient, err := foo.NewAPIClient(cfgOptions...)
41-
if err != nil {
42-
p.Debug(print.ErrorLevel, "create new API client: %v", err)
43-
return nil, &errors.AuthError{}
44-
}
45-
46-
return apiClient, nil
12+
return genericclient.ConfigureClientGeneric(p, cliVersion, viper.GetString(config.fooCustomEndpointKey), false, genericclient.CreateApiClient[*foo.APIClient](foo.NewAPIClient))
4713
}

.github/docs/contribution-guide/cmd.go

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package bar
22

33
import (
44
"context"
5-
"encoding/json"
65
"fmt"
76

87
"github.com/spf13/cobra"
@@ -17,7 +16,6 @@ import (
1716
"github.com/stackitcloud/stackit-cli/internal/pkg/services/alb/client"
1817
"github.com/stackitcloud/stackit-cli/internal/pkg/tables"
1918
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
20-
"gopkg.in/yaml.v2"
2119
// (...)
2220
)
2321

@@ -118,22 +116,8 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *foo.APIClie
118116

119117
// Output result based on the configured output format
120118
func outputResult(p *print.Printer, cmd *cobra.Command, outputFormat string, resources []foo.Resource) error {
121-
switch outputFormat {
122-
case print.JSONOutputFormat:
123-
details, err := json.MarshalIndent(resources, "", " ")
124-
if err != nil {
125-
return fmt.Errorf("marshal resource list: %w", err)
126-
}
127-
p.Outputln(string(details))
128-
return nil
129-
case print.YAMLOutputFormat:
130-
details, err := yaml.Marshal(resources)
131-
if err != nil {
132-
return fmt.Errorf("marshal resource list: %w", err)
133-
}
134-
p.Outputln(string(details))
135-
return nil
136-
default:
119+
// the output result handles JSON/YAML output, you can pass your own callback func for pretty (default) output format
120+
return p.OutputResult(outputFormat, resources, func() error {
137121
table := tables.NewTable()
138122
table.SetHeader("ID", "NAME", "STATE")
139123
for i := range resources {
@@ -145,5 +129,5 @@ func outputResult(p *print.Printer, cmd *cobra.Command, outputFormat string, res
145129
return fmt.Errorf("render table: %w", err)
146130
}
147131
return nil
148-
}
132+
})
149133
}

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: make test
3737

3838
- name: Archive code coverage results
39-
uses: actions/upload-artifact@v4
39+
uses: actions/upload-artifact@v5
4040
with:
4141
name: ${{ env.CODE_COVERAGE_ARTIFACT_NAME }}
4242
path: ${{ env.CODE_COVERAGE_FILE_NAME }}

.github/workflows/release.yaml

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ jobs:
4141
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
4242
passphrase: ${{ secrets.GPG_PASSPHRASE }}
4343

44+
# nfpm-rpm signing needs gpg provided as filepath
45+
# https://goreleaser.com/customization/nfpm/
46+
- name: Create GPG key file
47+
run: |
48+
KEY_PATH="$RUNNER_TEMP/gpg-private-key.asc"
49+
printf '%s' "${{ secrets.GPG_PRIVATE_KEY }}" > "$KEY_PATH"
50+
chmod 600 "$KEY_PATH"
51+
echo "GPG_KEY_PATH=$KEY_PATH" >> "$GITHUB_ENV"
52+
4453
- name: Set up keychain
4554
run: |
4655
echo -n $SIGNING_CERTIFICATE_BASE64 | base64 -d -o ./ApplicationID.p12
@@ -71,15 +80,22 @@ jobs:
7180
env:
7281
GITHUB_TOKEN: ${{ secrets.CLI_RELEASE }}
7382
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
83+
GPG_KEY_PATH: ${{ env.GPG_KEY_PATH }}
84+
# nfpm-rpm signing needs this env to be set.
85+
NFPM_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
7486

75-
# artifacts need to be passed to the "publish-apt" job somehow
87+
- name: Clean up GPG key file
88+
if: always()
89+
run: |
90+
rm -f "$GPG_KEY_PATH"
91+
7692
- name: Upload artifacts to workflow
77-
uses: actions/upload-artifact@v4
93+
uses: actions/upload-artifact@v5
7894
with:
7995
name: goreleaser-dist-temp
8096
path: dist
8197
retention-days: 1
82-
98+
8399
publish-apt:
84100
name: Publish APT
85101
runs-on: macOS-latest
@@ -94,7 +110,7 @@ jobs:
94110

95111
# use the artifacts from the "goreleaser" job
96112
- name: Download artifacts from workflow
97-
uses: actions/download-artifact@v5
113+
uses: actions/download-artifact@v6
98114
with:
99115
name: goreleaser-dist-temp
100116
path: dist
@@ -115,3 +131,42 @@ jobs:
115131
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
116132
GPG_PRIVATE_KEY_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
117133
run: ./scripts/publish-apt-packages.sh
134+
135+
publish-rpm:
136+
name: Publish RPM
137+
runs-on: ubuntu-latest
138+
needs: [goreleaser]
139+
env:
140+
# Needed to publish new packages to our S3-hosted RPM repo
141+
AWS_ACCESS_KEY_ID: ${{ secrets.OBJECT_STORAGE_ACCESS_KEY_ID }}
142+
AWS_SECRET_ACCESS_KEY: ${{ secrets.OBJECT_STORAGE_SECRET_ACCESS_KEY }}
143+
AWS_DEFAULT_REGION: eu01
144+
AWS_ENDPOINT_URL: https://object.storage.eu01.onstackit.cloud
145+
steps:
146+
- name: Checkout
147+
uses: actions/checkout@v5
148+
149+
- name: Download artifacts from workflow
150+
uses: actions/download-artifact@v6
151+
with:
152+
name: goreleaser-dist-temp
153+
path: dist
154+
155+
- name: Install RPM tools
156+
run: |
157+
sudo apt-get update
158+
sudo apt-get install -y createrepo-c
159+
160+
- name: Import GPG key
161+
uses: crazy-max/ghaction-import-gpg@v6
162+
id: import_gpg
163+
with:
164+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
165+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
166+
167+
- name: Publish RPM packages
168+
if: contains(github.ref_name, '-') == false
169+
env:
170+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
171+
GPG_PRIVATE_KEY_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
172+
run: ./scripts/publish-rpm-packages.sh

.github/workflows/renovate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v5
1515
- name: Self-hosted Renovate
16-
uses: renovatebot/github-action@v43.0.16
16+
uses: renovatebot/github-action@v44.0.2
1717
with:
1818
configurationFile: .github/renovate.json
1919
token: ${{ secrets.RENOVATE_TOKEN }}

.goreleaser.yaml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,10 @@ nfpms:
9999
- deb
100100
- rpm
101101

102-
signs:
103-
- artifacts: package
104-
args:
105-
[
106-
"-u",
107-
"{{ .Env.GPG_FINGERPRINT }}",
108-
"--output",
109-
"${signature}",
110-
"--detach-sign",
111-
"${artifact}",
112-
]
102+
rpm:
103+
# The package is signed if a key_file is set
104+
signature:
105+
key_file: "{{ .Env.GPG_KEY_PATH }}"
113106

114107
homebrew_casks:
115108
- name: stackit

INSTALLATION.md

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,54 @@ asset_filters=["stackit-cli_", "_linux_amd64.tar.gz"]
130130
eget stackitcloud/stackit-cli
131131
```
132132

133-
#### RPM package via dnf, yum and zypper
133+
#### RHEL/Fedora/Rocky/Alma/openSUSE/... (`DNF/YUM/Zypper`)
134134

135-
The STACKIT CLI is available as [RPM Package](https://github.com/stackitcloud/stackit-cli/releases) and can be installed via dnf, yum and zypper package manager.
135+
The STACKIT CLI can be installed through the [`DNF/YUM`](https://docs.fedoraproject.org/en-US/fedora/f40/system-administrators-guide/package-management/DNF/) / [`Zypper`](https://de.opensuse.org/Zypper) package managers.
136136

137-
Just download the rpm package from the [release page](https://github.com/stackitcloud/stackit-cli/releases) and run the install command like the following:
137+
> Requires rpm version 4.15 or newer to support Ed25519 signatures.
138+
139+
> `$basearch` is supported by modern distributions. On older systems that don't expand `$basearch`, replace it in the `baseurl` with your architecture explicitly (for example, `.../rpm/cli/x86_64` or `.../rpm/cli/aarch64`).
140+
141+
##### Installation via DNF/YUM
142+
143+
1. Add the repository:
144+
145+
```shell
146+
sudo tee /etc/yum.repos.d/stackit.repo > /dev/null << 'EOF'
147+
[stackit]
148+
name=STACKIT CLI
149+
baseurl=https://packages.stackit.cloud/rpm/cli/$basearch
150+
enabled=1
151+
gpgcheck=1
152+
gpgkey=https://packages.stackit.cloud/keys/key.gpg
153+
EOF
154+
```
155+
156+
2. Install the CLI:
157+
158+
```shell
159+
sudo dnf install stackit
160+
```
161+
162+
##### Installation via Zypper
163+
164+
1. Add the repository:
165+
166+
```shell
167+
sudo tee /etc/zypp/repos.d/stackit.repo > /dev/null << 'EOF'
168+
[stackit]
169+
name=STACKIT CLI
170+
baseurl=https://packages.stackit.cloud/rpm/cli/$basearch
171+
enabled=1
172+
gpgcheck=1
173+
gpgkey=https://packages.stackit.cloud/keys/key.gpg
174+
EOF
175+
```
176+
177+
2. Install the CLI:
138178

139179
```shell
140-
dnf install stackitcli.rpm
141-
yum install stackitcli.rpm
142-
zypper install stackitcli.rpm
180+
sudo zypper install stackit
143181
```
144182

145183
#### Any distribution

docs/stackit_beta.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ stackit beta [flags]
4343
* [stackit](./stackit.md) - Manage STACKIT resources using the command line
4444
* [stackit beta alb](./stackit_beta_alb.md) - Manages application loadbalancers
4545
* [stackit beta intake](./stackit_beta_intake.md) - Provides functionality for intake
46+
* [stackit beta kms](./stackit_beta_kms.md) - Provides functionality for KMS
4647
* [stackit beta sqlserverflex](./stackit_beta_sqlserverflex.md) - Provides functionality for SQLServer Flex
4748

docs/stackit_beta_kms.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## stackit beta kms
2+
3+
Provides functionality for KMS
4+
5+
### Synopsis
6+
7+
Provides functionality for KMS.
8+
9+
```
10+
stackit beta kms [flags]
11+
```
12+
13+
### Options
14+
15+
```
16+
-h, --help Help for "stackit beta kms"
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
-y, --assume-yes If set, skips all confirmation prompts
23+
--async If set, runs the command asynchronously
24+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
25+
-p, --project-id string Project ID
26+
--region string Target region for region-specific requests
27+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
28+
```
29+
30+
### SEE ALSO
31+
32+
* [stackit beta](./stackit_beta.md) - Contains beta STACKIT CLI commands
33+
* [stackit beta kms key](./stackit_beta_kms_key.md) - Manage KMS keys
34+
* [stackit beta kms keyring](./stackit_beta_kms_keyring.md) - Manage KMS key rings
35+
* [stackit beta kms version](./stackit_beta_kms_version.md) - Manage KMS key versions
36+
* [stackit beta kms wrapping-key](./stackit_beta_kms_wrapping-key.md) - Manage KMS wrapping keys
37+

docs/stackit_beta_kms_key.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## stackit beta kms key
2+
3+
Manage KMS keys
4+
5+
### Synopsis
6+
7+
Provides functionality for key operations inside the KMS
8+
9+
```
10+
stackit beta kms key [flags]
11+
```
12+
13+
### Options
14+
15+
```
16+
-h, --help Help for "stackit beta kms key"
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
-y, --assume-yes If set, skips all confirmation prompts
23+
--async If set, runs the command asynchronously
24+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
25+
-p, --project-id string Project ID
26+
--region string Target region for region-specific requests
27+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
28+
```
29+
30+
### SEE ALSO
31+
32+
* [stackit beta kms](./stackit_beta_kms.md) - Provides functionality for KMS
33+
* [stackit beta kms key create](./stackit_beta_kms_key_create.md) - Creates a KMS key
34+
* [stackit beta kms key delete](./stackit_beta_kms_key_delete.md) - Deletes a KMS key
35+
* [stackit beta kms key import](./stackit_beta_kms_key_import.md) - Import a KMS key
36+
* [stackit beta kms key list](./stackit_beta_kms_key_list.md) - List all KMS keys
37+
* [stackit beta kms key restore](./stackit_beta_kms_key_restore.md) - Restore a key
38+
* [stackit beta kms key rotate](./stackit_beta_kms_key_rotate.md) - Rotate a key
39+

0 commit comments

Comments
 (0)