scaleway

package module
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 25 Imported by: 0

README

Fleeting Plugin Scaleway

Pipeline Status Coverage Go Report Releases Maturity License

⚠️ WARNING: This project is in a very early stage and under active development. It is not production-ready.

Use at your own risk. Breaking changes, incomplete features, and instability are expected.

A fleeting plugin for Scaleway.

This tool was created to leverage GitLab's Next Runner Auto-scaling Architecture with Scaleway, and take advantage of the new features that comes with it.

Docs

For more information, see the documentation.

Releases

This project adheres to Semantic Versioning.

Please read the changelog before upgrading.

Contribute

First and foremost, thank you! We appreciate that you want to contribute to this project.

When submitting your contribution to this project, make sure that:

  • all the pre-commit hooks passes:

    pre-commit run --all-files
    

    Note: We use prek as a drop-in replacement for pre-commit to speed up the execution of the hooks.

  • all tests passes:

    make test
    
  • any relevant documentation is updated with your changes.

Development

Building the plugin

To build the binary, ensure that your go version is up-to-date, and run the following:

$ make build
Testing the plugin locally

To run the unit tests, run the following:

$ make test

For the integration tests to run, you need to export some environment variables before starting the tests:

  • SCW_ACCESS_KEY: Your Scaleway access key.
  • SCW_SECRET_KEY: Your Scaleway secret key.
  • SCW_ORGANIZATION_ID: Your Scaleway organization ID.
  • SCW_PROJECT_ID: Your Scaleway project ID.
  • SCW_DEFAULT_ZONE: The Scaleway zone you want to use (e.g., fr-par-1).
Testing the plugin with GitLab Runner

Sometimes, you want to test the whole plugin as its being executed by GitLab's Fleeting mechanism. Use an approach like this:

  1. Build the plugin by running the following:

    $ cd cmd/fleeting-plugin-scaleway
    $ go build
    
  2. Set up the plugin in GitLab Runner's config.toml file using the approach described above, but update plugin = "/path/to/fleeting-plugin-scaleway" to point to your cmd/fleeting-plugin-scaleway/fleeting-plugin-scaleway

  3. Run gitlab-runner run or similar, to run GitLab Runner interactively as a foreground process.

  4. Make a CI job run using this runner, perhaps using special tags: or similar (to avoid breaking things for other CI jobs on the same GitLab installation).

Setup a development environment

To setup a development environment, make sure you installed the following tools:

  1. Configure Scaleway environment variables (SCW_ACCESS_KEY, SCW_SECRET_KEY, SCW_ORGANIZATION_ID, SCW_PROJECT_ID, SCW_DEFAULT_ZONE) and RUNNER_TOKEN in your shell session.

[!WARNING] The development environment creates Scaleway servers which will induce costs.

  1. Run the development environment:
make -C dev up

Also run this command to update the development environment with your latest code changes.

  1. Check that the development environment is healthy:
docker compose logs

⚠️ Do not forget to clean up the development cluster once are finished:

make -C dev down
Creating a new release

We now use git-cliff to manage releases. To create a new release, manually create a Git tag. Once the tag is pushed, the release is automatically created, and artifacts are added.

History

The project started out as a fork of the existing gitlab.com/hetznercloud/fleeting-plugin-hetzner plugin, gradually replacing the Hetzner Cloud calls with calls to the Scaleway API. To all the people involved in this initial work, thanks a lot!

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NAME      = "fleeting-plugin-scaleway"
	VERSION   = "dev"
	REVISION  = "HEAD"
	REFERENCE = "HEAD"
	BUILT     = "now"

	Version plugin.VersionInfo
)

Functions

This section is empty.

Types

type InstanceGroup

type InstanceGroup struct {
	Name string `json:"name"`

	AccessKey    string `json:"access_key"`
	SecretKey    string `json:"secret_key"`
	Organization string `json:"organization"`
	Project      string `json:"project"`
	Endpoint     string `json:"endpoint"`

	Zone          string        `json:"zone"`
	ServerTypes   LaxStringList `json:"server_type"`
	Image         string        `json:"image"`
	CloudInit     string        `json:"cloud_init"`
	CloudInitFile string        `json:"cloud_init_file"`

	VolumeType string `json:"volume_type"`
	VolumeSize uint16 `json:"volume_size"`
	VolumeIops uint16 `json:"volume_iops"`

	PublicIPv4Disabled bool          `json:"public_ipv4_disabled"`
	PublicIPv6Disabled bool          `json:"public_ipv6_disabled"`
	PrivateNetworkIDs  LaxStringList `json:"private_network_ids"`

	Tags []string `json:"tags"`
	// contains filtered or unexported fields
}

func (*InstanceGroup) ConnectInfo

func (g *InstanceGroup) ConnectInfo(ctx context.Context, iid string) (provider.ConnectInfo, error)

func (*InstanceGroup) Decrease

func (g *InstanceGroup) Decrease(ctx context.Context, iids []string) ([]string, error)

func (*InstanceGroup) Heartbeat

func (g *InstanceGroup) Heartbeat(_ context.Context, _ string) error

func (*InstanceGroup) Increase

func (g *InstanceGroup) Increase(ctx context.Context, delta int) (int, error)

func (*InstanceGroup) Init

func (g *InstanceGroup) Init(ctx context.Context, log hclog.Logger, settings provider.Settings) (info provider.ProviderInfo, err error)

func (*InstanceGroup) Shutdown

func (g *InstanceGroup) Shutdown(ctx context.Context) error

func (*InstanceGroup) Update

func (g *InstanceGroup) Update(ctx context.Context, update func(string, provider.State)) error

func (*InstanceGroup) UploadSSHPublicKey

func (g *InstanceGroup) UploadSSHPublicKey(ctx context.Context, pub []byte) (sshKey *scwIam.SSHKey, err error)

type LaxStringList

type LaxStringList []string

func (*LaxStringList) UnmarshalJSON

func (o *LaxStringList) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
cmd
internal
instancegroup
Package instancegroup is a generated GoMock package.
Package instancegroup is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL