2021-08-31 14:39:45 +02:00
|
|
|
# Instead of setup, this runs only once
|
|
|
|
setup_file() {
|
2021-09-09 13:03:07 +02:00
|
|
|
load 'helpers'
|
2021-08-31 14:39:45 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
setup_localstack
|
2021-08-31 14:39:45 +02:00
|
|
|
}
|
|
|
|
|
2021-06-09 21:08:03 +02:00
|
|
|
setup() {
|
2021-09-09 13:03:07 +02:00
|
|
|
load 'helpers'
|
2021-06-09 21:08:03 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
common_setup
|
2021-06-09 21:08:03 +02:00
|
|
|
}
|
|
|
|
|
2021-06-23 16:31:42 +02:00
|
|
|
@test "cue-sanity-check" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e sanity-check up
|
2021-06-23 16:31:42 +02:00
|
|
|
}
|
|
|
|
|
2021-06-09 20:37:05 +02:00
|
|
|
@test "os" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e os up
|
2021-06-09 20:37:05 +02:00
|
|
|
}
|
|
|
|
|
2021-06-17 15:20:47 +02:00
|
|
|
@test "go" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e go up
|
2021-06-17 15:20:47 +02:00
|
|
|
}
|
|
|
|
|
2021-06-10 12:50:49 +02:00
|
|
|
@test "js/yarn" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e js-yarn up
|
2021-06-10 12:50:49 +02:00
|
|
|
}
|
|
|
|
|
2021-06-29 12:11:57 +02:00
|
|
|
@test "java/maven" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e java-maven up
|
2021-06-29 12:11:57 +02:00
|
|
|
}
|
|
|
|
|
2021-06-10 12:29:49 +02:00
|
|
|
@test "alpine" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e alpine up
|
2021-06-10 12:29:49 +02:00
|
|
|
}
|
|
|
|
|
2021-06-09 21:08:03 +02:00
|
|
|
@test "netlify" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e netlify up
|
2021-06-09 21:08:03 +02:00
|
|
|
}
|
|
|
|
|
2021-06-16 10:00:01 +02:00
|
|
|
@test "git" {
|
2021-09-09 13:03:07 +02:00
|
|
|
# Fetch repo
|
|
|
|
dagger -e git-repo up
|
2021-09-01 18:49:21 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# Commit & push
|
|
|
|
dagger -e git-commit up
|
2021-06-16 10:00:01 +02:00
|
|
|
}
|
|
|
|
|
2021-06-23 12:46:56 +02:00
|
|
|
@test "os.#Container" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e os-container up
|
2021-06-23 12:46:56 +02:00
|
|
|
}
|
|
|
|
|
2021-06-09 21:08:03 +02:00
|
|
|
@test "aws: ecr" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e aws-ecr up
|
2021-06-09 21:08:03 +02:00
|
|
|
}
|
|
|
|
|
2021-08-18 15:09:28 +02:00
|
|
|
@test "aws: ecr/localstack" {
|
2021-09-09 13:03:07 +02:00
|
|
|
skip_unless_local_localstack
|
2021-08-18 15:09:28 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e aws-ecr-localstack up
|
2021-08-18 15:09:28 +02:00
|
|
|
}
|
|
|
|
|
2021-06-09 21:08:03 +02:00
|
|
|
@test "aws: s3" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e aws-s3 up
|
2021-06-09 21:08:03 +02:00
|
|
|
}
|
|
|
|
|
2021-08-18 15:09:28 +02:00
|
|
|
@test "aws: s3/localstack" {
|
2021-09-09 13:03:07 +02:00
|
|
|
skip_unless_local_localstack
|
2021-08-18 15:09:28 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e aws-s3-localstack up
|
2021-08-18 15:09:28 +02:00
|
|
|
}
|
|
|
|
|
2021-06-18 18:03:59 +02:00
|
|
|
@test "aws: eks" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e aws-eks up
|
2021-06-18 18:03:59 +02:00
|
|
|
}
|
|
|
|
|
2021-06-09 21:08:03 +02:00
|
|
|
@test "docker run: local" {
|
2021-09-09 13:03:07 +02:00
|
|
|
skip "Not implemented yet + missing inputs leading to failure"
|
|
|
|
# dagger -e docker-run-local up
|
2021-06-09 21:08:03 +02:00
|
|
|
}
|
|
|
|
|
2021-06-18 18:03:59 +02:00
|
|
|
@test "docker build" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e docker-build up
|
2021-06-18 18:03:59 +02:00
|
|
|
}
|
|
|
|
|
2021-06-12 17:11:27 +02:00
|
|
|
@test "docker push and pull" {
|
|
|
|
# Push image
|
|
|
|
dagger -e docker-push up
|
|
|
|
|
|
|
|
# Get image reference
|
2021-06-12 17:11:41 +02:00
|
|
|
dagger -e docker-pull input text ref "$(dagger -e docker-push query -c TestPush.push.ref | tr -d '\n' | tr -d '\"')"
|
2021-06-12 17:11:27 +02:00
|
|
|
|
|
|
|
# Pull image
|
|
|
|
dagger -e docker-pull up
|
|
|
|
}
|
|
|
|
|
2021-07-01 15:48:03 +02:00
|
|
|
@test "docker push: multi registry" {
|
2021-09-09 13:03:07 +02:00
|
|
|
run dagger -e docker-push-multi-registry up
|
2021-07-01 15:48:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "docker push: invalid credential" {
|
2021-06-12 17:11:27 +02:00
|
|
|
# Push image (SHOULD FAIL)
|
2021-06-12 17:11:41 +02:00
|
|
|
run dagger -e docker-push-invalid-creds up
|
2021-06-12 17:11:27 +02:00
|
|
|
assert_failure
|
|
|
|
}
|
|
|
|
|
2021-06-11 09:53:14 +02:00
|
|
|
@test "docker command: ssh" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e docker-command-ssh up
|
2021-06-11 09:53:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "docker command: ssh with key passphrase" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e docker-command-ssh-key-passphrase up
|
2021-06-11 09:53:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "docker command: ssh with wrong key passphrase" {
|
2021-09-09 13:03:07 +02:00
|
|
|
run dagger -e docker-command-ssh-wrong-key-passphrase up
|
|
|
|
assert_failure
|
2021-06-11 09:53:14 +02:00
|
|
|
}
|
|
|
|
|
2021-06-25 15:40:49 +02:00
|
|
|
@test "docker compose" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e docker-compose up
|
2021-06-17 17:12:51 +02:00
|
|
|
}
|
|
|
|
|
2021-06-09 21:08:03 +02:00
|
|
|
@test "docker run: ssh" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e docker-run-ssh up
|
2021-06-09 21:08:03 +02:00
|
|
|
}
|
|
|
|
|
2021-06-18 18:03:59 +02:00
|
|
|
@test "kubernetes: deployment" {
|
2021-09-09 13:03:07 +02:00
|
|
|
skip_unless_local_kube
|
2021-06-18 18:03:59 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# Copy deployment to sandbox
|
|
|
|
copy_to_sandbox kubernetes-deployment kubernetes
|
2021-06-18 19:15:48 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# Set kubeconfig
|
|
|
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-deployment input text TestKubeconfig -f "$HOME"/.kube/config
|
2021-06-18 18:03:59 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-deployment up
|
2021-06-18 18:03:59 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# Unset kubeconfig
|
|
|
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-deployment input unset TestKubeconfig
|
2021-06-18 18:03:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "kubernetes: kustomize" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e kubernetes-kustomize up
|
2021-06-18 18:03:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "kubernetes: helm" {
|
2021-09-09 13:03:07 +02:00
|
|
|
skip_unless_local_kube
|
2021-06-18 18:03:59 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# Copy deployment to sandbox
|
|
|
|
copy_to_sandbox kubernetes-helm kubernetes
|
2021-06-18 19:15:48 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# Set kubeconfig
|
|
|
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-helm input text TestKubeconfig -f "$HOME"/.kube/config
|
2021-06-18 18:03:59 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-helm up
|
2021-06-18 18:03:59 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# Unset kubeconfig
|
|
|
|
dagger -w "$DAGGER_SANDBOX" -e kubernetes-helm input unset TestKubeconfig
|
2021-06-18 18:03:59 +02:00
|
|
|
}
|
|
|
|
|
2021-06-09 21:08:03 +02:00
|
|
|
@test "google cloud: gcr" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e google-gcr up
|
2021-06-09 21:08:03 +02:00
|
|
|
}
|
|
|
|
|
2021-06-30 12:18:21 +02:00
|
|
|
@test "google cloud: gcs" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e google-gcs up
|
2021-06-30 12:18:21 +02:00
|
|
|
}
|
2021-06-30 06:31:23 +02:00
|
|
|
|
2021-06-09 21:08:03 +02:00
|
|
|
@test "google cloud: gke" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e google-gke up
|
2021-06-09 21:08:03 +02:00
|
|
|
}
|
2021-06-21 11:26:54 +02:00
|
|
|
|
|
|
|
@test "google cloud: cloudrun" {
|
2021-09-09 13:03:07 +02:00
|
|
|
dagger -e google-cloudrun up
|
2021-06-21 11:26:54 +02:00
|
|
|
}
|
2021-06-22 12:30:48 +02:00
|
|
|
|
2021-06-18 18:03:59 +02:00
|
|
|
@test "terraform" {
|
2021-09-09 13:03:07 +02:00
|
|
|
# it must fail because of a missing var
|
|
|
|
run dagger -e terraform up
|
|
|
|
assert_failure
|
2021-06-18 18:03:59 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# Copy deployment to sandbox
|
|
|
|
copy_to_sandbox terraform terraform
|
2021-06-18 19:15:48 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# Add the var and try again
|
|
|
|
run dagger -w "$DAGGER_SANDBOX" -e terraform input text TestTerraform.apply.tfvars.input "42"
|
|
|
|
run dagger -w "$DAGGER_SANDBOX" -e terraform up
|
|
|
|
assert_success
|
2021-06-18 18:03:59 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# ensure the tfvar was passed correctly
|
|
|
|
run dagger -w "$DAGGER_SANDBOX" query -e terraform TestTerraform.apply.output.input.value -f text
|
|
|
|
assert_success
|
|
|
|
assert_output "42"
|
2021-06-18 18:03:59 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# ensure the random value is always the same
|
|
|
|
# this proves we're effectively using the s3 backend
|
|
|
|
run dagger -w "$DAGGER_SANDBOX" query -e terraform TestTerraform.apply.output.random.value -f json
|
|
|
|
assert_success
|
|
|
|
assert_output "36"
|
2021-06-18 18:03:59 +02:00
|
|
|
|
2021-09-09 13:03:07 +02:00
|
|
|
# Unset input
|
|
|
|
run dagger -w "$DAGGER_SANDBOX" -e terraform input unset TestTerraform.apply.tfvars.input
|
|
|
|
assert_success
|
2021-06-22 12:30:48 +02:00
|
|
|
}
|
2021-08-10 19:20:16 +02:00
|
|
|
|
2021-08-11 15:16:56 +02:00
|
|
|
@test "azure-resourcegroup" {
|
2021-09-09 13:03:07 +02:00
|
|
|
skip "Azure CI infra not implemented yet - manually tested and working"
|
|
|
|
#dagger -e azure-resourcegroup up
|
2021-08-17 11:23:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "azure-storage" {
|
2021-09-09 13:03:07 +02:00
|
|
|
skip "Azure CI infra not implemented yet - manually tested and working"
|
|
|
|
#dagger -e azure-storage up
|
2021-08-30 23:03:04 +02:00
|
|
|
}
|
2021-08-13 16:43:06 +02:00
|
|
|
|
|
|
|
@test "argocd" {
|
2021-09-09 13:03:07 +02:00
|
|
|
skip_unless_local_kube
|
|
|
|
|
|
|
|
# Deploy argoCD infra
|
|
|
|
# dagger -e argocd-infra input text TestKubeconfig -f "$HOME"/.kube/config
|
|
|
|
#dagger -e argocd-infra up
|
|
|
|
# pid=$!
|
|
|
|
|
|
|
|
curl localhost:8080
|
|
|
|
|
|
|
|
# Kill Pid
|
|
|
|
#check_pid=$(pgrep "$pid")
|
|
|
|
#if [ "$pid" -eq "$check_pid" ]; then
|
|
|
|
# kill "$pid"
|
|
|
|
#fi
|
|
|
|
# skip "ArgoCD CI secrets not yet generated - Infra not implemented yet"
|
|
|
|
# dagger -e argocd input secret TestConfig.argocdConfig.token "$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo)"
|
|
|
|
# dagger -e argocd up
|
|
|
|
|
|
|
|
# Kill forward
|
|
|
|
# >&2 echo "kill pid"
|
2021-08-13 16:43:06 +02:00
|
|
|
}
|