forked from cloudbase/garm
-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (121 loc) · 4.43 KB
/
integration-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Integration Tests
on:
push:
branches:
- add-integration-tests
jobs:
garm-cli-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- run: go version
- name: Setup LXD
uses: canonical/setup-lxd@v0.1.1
- name: Build GARM
run: make build
- name: Setup GARM server
shell: bash
run: |
set -e
set -o pipefail
sudo useradd --shell /usr/bin/false --system --groups lxd --no-create-home garm
sudo mkdir -p /etc/garm /var/log/garm
# Use the LXD bridge IP address as the GARM metadata address.
GARM_METADATA_IP=$(sudo lxc network ls -f json | jq -r '.[] | select(.name=="lxdbr0") | .config."ipv4.address"' | cut -d '/' -f1)
cat > config.toml << EOF
[default]
callback_url = "http://${GARM_METADATA_IP}:9997/api/v1/callbacks/status"
metadata_url = "http://${GARM_METADATA_IP}:9997/api/v1/metadata"
[metrics]
enable = true
disable_auth = false
[jwt_auth]
secret = ")9gk_4A6KrXz9D2u`0@MPea*sd6W`%@5MAWpWWJ3P3EqW~qB!!(Vd$FhNc*eU4vG"
time_to_live = "8760h"
[apiserver]
bind = "0.0.0.0"
port = 9997
use_tls = false
[database]
backend = "sqlite3"
passphrase = "shreotsinWadquidAitNefayctowUrph"
[database.sqlite3]
db_file = "/etc/garm/garm.db"
[[provider]]
name = "lxd_local"
provider_type = "lxd"
description = "Local LXD installation"
[provider.lxd]
unix_socket_path = "/var/snap/lxd/common/lxd/unix.socket"
include_default_profile = false
instance_type = "container"
secure_boot = false
project_name = "default"
url = ""
client_certificate = ""
client_key = ""
tls_server_certificate = ""
[provider.lxd.image_remotes]
[provider.lxd.image_remotes.ubuntu]
addr = "https://cloud-images.ubuntu.com/releases"
public = true
protocol = "simplestreams"
skip_verify = false
[provider.lxd.image_remotes.ubuntu_daily]
addr = "https://cloud-images.ubuntu.com/daily"
public = true
protocol = "simplestreams"
skip_verify = false
[provider.lxd.image_remotes.images]
addr = "https://images.linuxcontainers.org"
public = true
protocol = "simplestreams"
skip_verify = false
EOF
sudo mv config.toml /etc/garm/config.toml
sudo chown -R garm:garm /etc/garm /var/log/garm
sudo mv ./bin/* /usr/local/bin/
sudo cp ./contrib/garm.service /etc/systemd/system/garm.service
sudo systemctl daemon-reload
sudo systemctl start garm
- name: Test GARM API with garm-cli tool
shell: bash
run: |
set -e
set -x
set -o pipefail
GARM_URL="http://127.0.0.1:9997"
ADMIN_USERNAME='admin'
ADMIN_PASWORD='Ma*jirksiCr9esrT8DGQPrfx*XKnBVZo'
garm-cli init --debug \
--name="local_garm" \
--url $GARM_URL \
--email root@localhost \
--username $ADMIN_USERNAME \
--password $ADMIN_PASWORD
garm-cli profile add --debug \
--name="local_garm_2" \
--url $GARM_URL \
--email root@localhost \
--username $ADMIN_USERNAME \
--password $ADMIN_PASWORD
garm-cli profile login --debug \
--username $ADMIN_USERNAME \
--password $ADMIN_PASWORD
garm-cli provider --debug list
garm-cli runner --debug list --all
garm-cli credentials --debug list
garm-cli job --debug list
garm-cli org --debug list
garm-cli repo --debug list
garm-cli enterprise --debug list
garm-cli pool --debug list --all
- name: Show GARM logs
run: |
sudo systemctl status garm
sudo journalctl -u garm --no-pager