buildpacks / ci

CI configuration for Cloud Native Buildpacks
https://ci.buildpacks.io
Apache License 2.0
9 stars 2 forks source link

Add terraform scripts for provisioning Packet Github Actions Runners #21

Closed aemengo closed 3 years ago

aemengo commented 4 years ago
terraform-apply

Introduces scripts that automate the creation and provisioning of packet.net Windows Github Actions Runners using terraform. Provisioning steps are extracted from the wiki documentation.

[#174630303]

To be discussed


Usage

For managing a Windows Github Actions Runner, one only needs to interact with the terraform wrapper script at: ./runners/scripts/terraformw.sh. The script wraps terraform commands; performing any prep steps before the main operations.

Configure LastPass First

The script assumes that the following 2 credential notes are available in LastPass:

  1. PACKET_AUTH_TOKEN: An authentication token that allows terraform to manage instances on your behalf. lpass show --note 'Shared-Cloud Native Buildpacks/packet-auth-token'
  2. PACKET_PROJECT_ID: The GUID representing a packet project where instances will be created. lpass show --note 'Shared-Cloud Native Buildpacks/packet-project-id'

Create a runner

To create a runner, invoke the terraform wrapper script without any arguments:

# pwd: ~/workspace/ci
$ ./runners/scripts/terraformw.sh
...

Note: This command will take about 20 minutes.

The process will standup a windows machine and perform much of the provisioning steps covered the wiki documentation. These steps include: Installing Hyper-V/Docker-Desktop, Preparing the actions-runner-win-x64-*.zip archive, Rebooting the Machine, and more.

However after the creation process is completed, one must still manually log into the machine and turn on the Docker-Desktop Application. (I've been unable to find out how to do this well programmatically).

Destroying a runner

To destroy a runner, invoke the terraform wrapper script with the destroy argument:

# pwd: ~/workspace/ci
$ ./runners/scripts/terraformw.sh destroy
...

Note: This command will take about 6 seconds.

Viewing runner credentials

To view credentials for a runner, invoke the terraform wrapper script with the output argument:

# pwd: ~/workspace/ci
$ ./runners/scripts/terraformw.sh output
...
hostname = windows-lcow
public_ip = xxx.xx.xx.100
root_password = <sensitive>
root_username = Admin

The password for the machine is marked 'sensitive'. To view the password, you must explicitly request to view its contents:

# pwd: ~/workspace/ci
$ ./runners/scripts/terraformw.sh output root_password
...
0123abcdefghijklmn

Other