返回介绍

UpCloud

发布于 2023-09-20 23:50:39 字数 3615 浏览 0 评论 0 收藏 0

Caution

Buildbot no longer supports Python 2.7 on the Buildbot master.

UpCloud

class buildbot.worker.upcloud.UpcloudLatentWorker

To start off, to use the UpCloud latent worker, you need to sign up on UpCloud.

  1. Go to https://www.upcloud.com/ and create an account.

  2. Once you are logged into your account, create a sub-account for buildbot to use. You need to tick the box enabling it for API usage. You should disable the box enabling web interface. You should not use your primary account for safety and security reasons.

Quick-start sample

from buildbot.plugins import worker
c['workers'].append(upcloud.UpcloudLatentWorker('upcloud-worker','pass',
    image='Debian GNU/Linux 9.3 (Stretch)',
    api_username="username",
    api_password="password",
    hostconfig = {
        "user_data":"""
/usr/bin/apt-get update
/usr/bin/apt-get install -y buildbot-slave
/usr/bin/buildslave create-slave --umask=022 /buildslave buildbot.example.com upcloud-01 slavepass
/usr/bin/buildslave start /buildslave
"""}))

Complete example with default values

from buildbot.plugins import worker
c['workers'].append(upcloud.UpcloudLatentWorker('upcloud-worker','pass',
    image='Debian GNU/Linux 9.3 (Stretch)',
    api_username="username",
    api_password="password",
    hostconfig = {
        "zone":"de-fra1",
        "plan":"1xCPU-1GB",
        "hostname":"hostname",
        "ssh_keys":["ssh-rsa ...."],
        "os_disk_size":10,
        "core_number":1,
        "memory_amount":512,
        "user_data":""
    }))

The image argument specifies the name of image in the image library. UUID is not currently supported.

The api_username and api_password are for the sub-account you created on UpCloud.

hostconfig can be used to set various aspects about the created host.
  • zone is a valid execution zone in UpCloud environment, check their API documentation <https://developers.upcloud.com/> for valid values.

  • plan is a valid pre-configured machine specification, or custom if you want to define your own. See their API documentation for valid values

  • user_data field is used to specify startup script to run on the host.

  • hostname specifies the hostname for the worker. Defaults to name of the worker.

  • ssh_keys specifies ssh key(s) to add for root account. Some images support only one SSH key. At the time of writing, only RSA keys are supported.

  • os_disk_size specifies size of the system disk.

  • core_number can be used to specify number of cores, when plan is custom.

  • memory_amount can be used to specify memory in megabytes, when plan is custom.

  • user_data can be used to specify either URL to script, or script to execute when machine is started.

Note that by default buildbot retains latent workers for 10 minutes, see build_wait_time on how to change this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文