Skip to content
andopando19Public

About

A CLI and TUI for Hawkbit's management API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

85 Commits

Folders and files

Repository files navigation

hawk-tui

A command-line interface tool for managing Hawkbit, a scalable and modular update server. This tool provides a user-friendly way to interact with Hawkbit without needing to make direct API calls.

Overview

hawk-tui is a Go-based CLI application that allows you to manage:

  • Targets - Device targets that can receive software updates
  • Software Modules - Software components with versions and types
  • Distribution Sets - Bundles of software modules that can be deployed
  • Rollouts - Phased deployments of distribution sets to targets

Installation

Prerequisites

  • Go 1.16 or higher

Building from Source

# Build the project
make build

# The binary will be created as `ht`
./ht --help

Clean up

make clean

Configuration

The tool requires authentication with a Hawkbit server. Configuration is provided via environment variables:

  • HAWKBIT_URL - Hawkbit server URL
  • HAWKBIT_USER - API username
  • HAWKBIT_PASS - API password

Usage

General Command Structure

ht [global-flags] <command> <subcommand> [flags]

Global Flags

  • -v, --verbose - Enable verbose debug logging

Commands

Target Management

Manage device targets.

ht target <subcommand> [flags]
# or use the alias: ht t <subcommand>

Subcommands:

  • show (alias: get) - Display detailed information about a target

    • -i, --id - Controller ID of the target (required)
    • --show-token - Display the security token
  • list (alias: ls) - List all targets

    • --short - Output only controller IDs as space-separated list
    • --show-token - Display security tokens
  • create - Create a new target

    • -n, --name - Target name (required)
    • -i, --id - Controller ID (optional, defaults to name)
    • --desc - Description (optional)
  • delete (aliases: remove, rm) - Delete a target

    • --id - Controller ID (required)
  • attr-get - Get a specific target attribute

    • -i, --id - Controller ID (required)
    • -a, --attribute - Attribute to retrieve: name, token (required)

Software Module Management

Manage software modules and artifacts.

ht software-module <subcommand> [flags]
# or use the alias: ht sm <subcommand>

Subcommands:

  • show (alias: get) - Display detailed information about a software module

    • --id - Module ID (required)
  • list (alias: ls) - List all software modules

  • create - Create a new software module

    • --name - Module name (required)
    • --version - Module version (required)
    • --type - Module type (required)
    • --file - Optional artifact file to upload
  • delete (aliases: remove, rm) - Delete a software module

    • --id - Module ID (required)
  • upload-artifact - Upload an artifact to a software module

    • --id - Module ID (required)
    • --file - Path to artifact file (required)
  • delete-artifact - Delete an artifact from a software module

    • --module-id - Module ID (required)
    • --artifact-id - Artifact ID (required)

Distribution Set Management

Manage distribution sets (collections of software modules).

ht distribution-set <subcommand> [flags]
# or use the alias: ht ds <subcommand>

Subcommands:

  • show (alias: get) - Display detailed information about a distribution set

    • --id - Distribution set ID (required)
  • list (alias: ls) - List all distribution sets

  • create - Create a new distribution set

    • --name - Distribution name (required)
    • --version - Distribution version (required)
    • --type - Distribution type (optional, defaults to 'os')
    • --description - Description (optional)
  • delete (aliases: remove, rm) - Delete a distribution set

    • --id - Distribution set ID (required)
  • assign-software-module (alias: asm) - Assign a software module to a distribution set

    • --dist-id - Distribution set ID (required)
    • --sw-module-id - Software module ID (required)
  • unassign-software-module (alias: usm) - Remove a software module from a distribution set

    • --dist-id - Distribution set ID (required)
    • --sw-module-id - Software module ID (required)
  • show-type - Display information about a distribution set type

    • --id - Distribution set type ID (required)
  • list-types - List all distribution set types

  • create-type - Create a new distribution set type

    • --name - Type name (required)
    • --key - Type key (required)

Rollout Management

Manage software rollouts (deployments to targets).

ht rollout <subcommand> [flags]
# or use the alias: ht r <subcommand>

Subcommands:

  • show (alias: get) - Display detailed information about a rollout

    • --id - Rollout ID (required)
  • list (alias: ls) - List all rollouts

  • create - Create a new rollout

    • --name - Rollout name (required)
    • --dist-id - Distribution set ID (required)
    • --target-filter - Target filter query (required)
    • --desc - Description (optional)
  • delete (aliases: remove, rm) - Delete a rollout

    • --id - Rollout ID (required)
  • start - Start a rollout

    • --id - Rollout ID (required)
  • pause - Pause a running rollout

    • --id - Rollout ID (required)

Raw API Access

Make direct API calls to Hawkbit.

ht api <endpoint> [flags]

Flags:

  • --method - HTTP method (GET, POST, DELETE, UPDATE) (required)
  • --body - Request body (optional)

Examples

Create a target

ht target create --name my-device --id device-123

Create a software module

ht software-module create --name firmware --version 1.0.0 --type os

List all targets

ht target list

Get target details with token

ht target show --id device-123 --show-token

Create and start a rollout

# Create a software module with a file
ht software-module create --name firmware --version 1.0.0 --type os --file /path/to/firmware.bin

# Create a distribution set
ht distribution-set create --name release-1 --version 1.0

# Assign the software module to the distribution set
ht distribution-set assign-sw --dist-id 1 --sw-module-id 1

# Create a rollout
ht rollout create --name deployment-1 --dist-id 1 --target-filter name==device-*

# Start the rollout
ht rollout start --id 1

Development

Build

make build

Clean

make clean

Help

make help

License

See LICENSE file for details.

About

A CLI and TUI for Hawkbit's management API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages