Fix the quick install scripts, and test them on Linux, macOS and Windows (#245) install.sh and install.bat read the latest version from data/releases.yml on the website, which the website no longer has, so both stopped at "Can't get the latest version". - Both take the version from the latest GitHub release, whose URL redirects to .../releases/tag/<version>; no API rate limit and no JSON to parse, in bash or cmd. - Both download from downloads.apache.org, falling back to archive.apache.org, which has every release but picks up a new one later. Downloads go to a temporary directory that is removed afterwards. - install.sh installs the binary for the machine's architecture (amd64, arm64, 386) instead of always amd64, also under Rosetta 2, accepts sha512sum or shasum, and uses sudo only when /usr/local/bin is not writable. - install.bat picks windows-386 on 32-bit Windows, checks the sha512 with Get-FileHash instead of parsing CertUtil output, and adds the install directory to the system PATH once. setx wrote the merged user and system PATH into the system PATH, cut it at 1024 characters, and added the directory again on every run. - A new Install Scripts workflow runs install.sh on ubuntu x64, ubuntu arm64 and macOS, and install.bat on Windows, twice each, when the scripts change and every Monday, since an outside change broke them last time.
The CLI (Command Line Interface) for Apache SkyWalking.
SkyWalking CLI is a command interaction tool for the SkyWalking user or OPS team, as an alternative besides using browser GUI. It is based on SkyWalking GraphQL query protocol, same as GUI.
Install the latest version with the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apache/skywalking-cli/master/scripts/install.sh)"
Use Homebrew to install swctl on the macOS.
brew update
brew install swctl
Besides that, you could still use the same command in Linux to install it.
Note: you need to start cmd or powershell in administrator mode.
curl -LO "https://raw.githubusercontent.com/apache/skywalking-cli/master/scripts/install.bat" && .\install.bat
Go to the download page to download all available binaries, including macOS, Linux, Windows.
If you want to try the latest features, you can compile the latest source code and build swctl by yourself. Building needs Go 1.26 or later. Run this in the root directory of the project:
git clone https://github.com/apache/skywalking-cli cd skywalking-cli make build
make build writes one binary per platform to ./bin/, named swctl-<version>-<os>-<arch>, for darwin (amd64, arm64), linux (386, amd64, arm64) and windows (386, amd64). <version> is dev-<short commit id> unless you set it, as in make build VERSION=0.16.0. A plain make also checks the license headers, lints and runs the tests before building, which needs license-eye and golangci-lint installed.
Then copy the binary for your OS and architecture to a directory in your PATH, usually /usr/local/bin, and rename it to swctl.
If you prefer to use Docker, skywalking-cli also provides Docker images for convenient usages since 0.9.0. We also push the snapshot Docker images to GitHub registry for developers who want to test the latest features, note that this is not Apache releases, and it's for test only, DO NOT use it in your production environment.
docker run -it --rm apache/skywalking-cli service ls # Or to use the snapshot Docker image docker run -it --rm ghcr.io/apache/skywalking-cli/skywalking-cli service ls
swctl provides auto-completion support for bash and powershell, which can save you a lot of typing.
The swctl completion script for bash can be generated with the command swctl completion bash. Sourcing the completion script in your shell enables swctl auto-completion:
swctl completion bash > bash_autocomplete && sudo cp ./bash_autocomplete /etc/bash_completion.d/swctl && echo >> ~/.bashrc && echo "export PROG=swctl" >> ~/.bashrc
After reloading your shell, swctl auto-completion should be working.
Similarly, run the following command in your powershell terminal to enable auto-completion:
set-executionpolicy remotesigned -Scope CurrentUser swctl completion powershell >> $profile
If you get an error like OpenError: (:) [Out-File], DirectoryNotFoundException, then you need to run the following command to create $profile file:
New-Item -Type file -Force $profile
After reloading your shell, swctl auto-completion should be working.
swctl builds the help manual inside the command itself with some useful example commands, please type swctl help after installation. If you want to look up detail manual for a specific sub-command, insert help before the last sub-command, for example, swctl service help list shows the manual for command swctl service list, and swctl install manifest help oap shows the manual for swctl install manifest oap.
Integrate skywalking-cli into your CD workflows to report events, this is an implementation of GitHub Actions, but we welcome you to contribute plugins of other CD platforms, like Jenkins, GitLab, etc.
The usage of integration for GitHub Actions is as follows.
# ... jobs: deploy: strategy: matrix: instance: - asia-southeast - asia-northeast name: Deploy Product Service runs-on: ubuntu-latest steps: # other steps such as checkout ... - name: Wrap the deployment steps with skywalking-cli uses: apache/skywalking-cli@master # we always suggest pinning a release tag or a commit SHA instead of `master` with: oap-url: ${{ secrets.OAP_URL }} # Required. Set the OAP backend URL, such as example.com:11800 auth-token: ${{ secrets.OAP_AUTH_TOKEN }} # Optional. OAP auth token if you enable authentication in OAP service: product # Required. Name of the service to be deployed instance: ${{ matrix.instance }} # Required. Name of the instance to be deployed endpoint: "" # Optional. Endpoint of the service, if any message: "Upgrade from {fromVersion} to {toVersion}" # Optional. The message of the event parameters: "" # Optional. The parameters in the message, if any layer: "GENERAL" # Required. Name of the layer to which the event belongs (case-insensitive) # your package / deployment steps...
SkyWalking CLI and SkyWalking OAP communicate with different query versions, here is a summary of the compatible versions of both. Note that many queries in older CLI releases can still work with new OAP versions and vice versa because most query APIs are forward-compatible. The compatibility table here only lists fully compatible OAP versions, which mean new query APIs are implemented in this specific version.
| SkyWalking CLI | OAP Server Version |
|---|---|
| > = 0.11.0 | > = 9.2.0 |
| > = 0.12.0 | > = 9.3.0 |
| > = 0.12.0 | > = 9.5.0 |
| > = 0.13.0 | > = 9.6.0 |
| > = 0.14.0 | > = 10.2.0 |
| > = 0.15.0 | > = 11.0.0 |
For developers who want to contribute to this project, see Contribution Guide