testing #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration Tests | |
on: | |
push: | |
branches: | |
- test-e2e-wip | |
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 | |
[[github]] | |
name = "mihaelabalutoiu" | |
description = "github token of user ionutbalutoiu" | |
oauth2_token = "${{ secrets.AUTH2_TOKEN_SECRETS }}" | |
[[github]] | |
name = "mihaelabalutoiu" | |
description = "github token of user mihaelabalutoiu-clone" | |
oauth2_token = "${{ secrets.AUTH2_TOKEN_SECRETS }}" | |
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 | |
wait_open_port() { | |
local ADDRESS="$1" | |
local PORT="$2" | |
local TIMEOUT=30 | |
SECONDS=0 | |
while true; do | |
if [[ $SECONDS -gt $TIMEOUT ]]; then | |
echo "ERROR: Port $PORT didn't open at $ADDRESS within $TIMEOUT seconds" | |
return 1 | |
fi | |
nc -v -w 5 -z "$ADDRESS" "$PORT" &>/dev/null && break || sleep 1 | |
done | |
echo "Port $PORT at address $ADDRESS is open" | |
} | |
wait_open_port 127.0.0.1 9997 | |
- name: Test GARM API | |
shell: bash | |
run: | | |
set -e | |
set -x | |
set -o pipefail | |
GARM_URL="http://127.0.0.1:9997" | |
GARM_USERNAME='admin' | |
GARM_PASWORD='Ma*jirksiCr9esrT8DGQPrfx*XKnBVZo' | |
GARM_FULLNAME='test-fullname' | |
GARM_EMAIL='test@example.com' | |
GARM_NAME='local_garm' | |
CREDENTIALS_NAME='test-credentials' | |
REPO_WEBHOOK_SECRET=${{ secrets.REPO_WEBHOOK_SECRET }} | |
ORG_WEBHOOK_SECRET=${{ secrets.ORG_WEBHOOK_SECRET }} | |
go run integration/e2e.go | |
- name: Show GARM logs | |
run: | | |
sudo systemctl status garm | |
sudo journalctl -u garm --no-pager |