Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaelabalutoiu committed Oct 24, 2023
1 parent d09f12d commit e811bed
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ jobs:
go run ./test/integration/main.go 2>&1 | tee /artifacts-logs/e2e.log
env:
GARM_BASE_URL: ${{ steps.ngrok.outputs.tunnel-url }}
ORG_NAME: gsamfira
REPO_NAME: garm-testing
ORG_NAME: test-garm-org
REPO_NAME: test-garm-repo
CREDENTIALS_NAME: test-garm-creds
WORKFLOW_FILE_NAME: test.yml
GH_TOKEN: ${{ secrets.GH_OAUTH_TOKEN }}
Expand Down Expand Up @@ -94,6 +94,6 @@ jobs:
go run ./test/integration/gh_cleanup/main.go
env:
GARM_BASE_URL: ${{ steps.ngrok.outputs.tunnel-url }}
ORG_NAME: gsamfira
REPO_NAME: garm-testing
ORG_NAME: test-garm-org
REPO_NAME: test-garm-repo
GH_TOKEN: ${{ secrets.GH_OAUTH_TOKEN }}
8 changes: 8 additions & 0 deletions test/integration/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ description = "Local LXD installation"
protocol = "simplestreams"
skip_verify = false

[[provider]]
name = "test_external"
description = "external test provider"
provider_type = "external"
[provider.external]
config_file = "/home/runner/work/garm/garm/integration/config/config_file"
provider_executable = "/home/runner/work/garm/garm/integration/scripts/garm-external-provider"

[[github]]
name = "${CREDENTIALS_NAME}"
description = "GARM GitHub OAuth token"
Expand Down
Empty file.
56 changes: 56 additions & 0 deletions test/integration/scripts/garm-external-provider
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

set -e
set -o pipefail

if [ ! -t 0 ]
then
INPUT=$(cat -)
fi

if [ -z "$GARM_PROVIDER_CONFIG_FILE" ]
then
echo "no config file specified in env"
exit 1
fi

source "$GARM_PROVIDER_CONFIG_FILE"

function CreateInstance() {
if [ -z "$INPUT" ]; then
echo "expected build params in stdin"
exit 1
fi

jq -rnc '{"provider_id": "test-provider-id", "name": "test-instance-name", "os_type": "linux", "os_name": "ubuntu", "os_version": "20.04", "os_arch": "x86_64", "status": "running"}'
}

case "$GARM_COMMAND" in
"CreateInstance")
CreateInstance
;;
"DeleteInstance")
echo "RemoveAllInstances not implemented"
exit 1
;;
"GetInstance")
echo "Get instance with id: ${GARM_INSTANCE_ID}"
;;
"ListInstances")
echo "List instances with pool id: ${GARM_POOL_ID}"
;;
"StartInstance")
echo "Start instance: ${GARM_INSTANCE_NAME} with id: ${GARM_INSTANCE_ID}"
;;
"StopInstance")
echo "Stop instance: ${GARM_INSTANCE_NAME} with id: ${GARM_INSTANCE_ID}"
;;
"RemoveAllInstances")
echo "RemoveAllInstances not implemented"
exit 1
;;
*)
echo "Invalid GARM provider command: \"$GARM_COMMAND\""
exit 1
;;
esac
2 changes: 1 addition & 1 deletion test/integration/scripts/setup-garm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function generate_secret() {
function wait_open_port() {
local ADDRESS="$1"
local PORT="$2"
local TIMEOUT=30
local TIMEOUT=60
SECONDS=0
while true; do
if [[ $SECONDS -gt $TIMEOUT ]]; then
Expand Down

0 comments on commit e811bed

Please sign in to comment.