Skip to content

Commit

Permalink
🐛 Make e2e scripts also work on mac (#1471)
Browse files Browse the repository at this point in the history
Make e2e scripts also work on mac
  • Loading branch information
johannesfrey authored Oct 15, 2024
1 parent 8c6ca52 commit 7bb3027
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion hack/ci-e2e-capi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ source "${REPO_ROOT}/hack/ci-e2e-sshkeys.sh"

# We need to export the HCLOUD_TOKEN as a environment variable
SSH_KEY_NAME=caph-e2e-$(
head /dev/urandom | tr -dc A-Za-z0-9 | head -c 12
LC_CTYPE=C dd if=/dev/urandom bs=1 count=100 2>/dev/null | base64 | tr -dc 'A-Za-z0-9' | head -c 12
echo ''
)
export SSH_KEY_PATH=/tmp/${SSH_KEY_NAME}
Expand Down
6 changes: 3 additions & 3 deletions hack/ci-hetzner-secret.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

echo -n $HETZNER_SSH_PUB > tmp_ssh_pub
echo -n $HETZNER_SSH_PRIV > tmp_ssh_priv
base64 -d tmp_ssh_priv > tmp_ssh_priv_enc
base64 -d tmp_ssh_pub > tmp_ssh_pub_enc
kubectl create secret generic robot-ssh --from-literal=sshkey-name=ci --from-file=ssh-privatekey=tmp_ssh_priv_enc --from-file=ssh-publickey=tmp_ssh_pub_enc --dry-run=client -o yaml > data/infrastructure-hetzner/v1beta1/cluster-template-hetzner-secret.yaml
base64 -d < tmp_ssh_priv > tmp_ssh_priv_enc
base64 -d < tmp_ssh_pub > tmp_ssh_pub_enc
kubectl create secret generic robot-ssh --from-literal=sshkey-name=ci --from-file=ssh-privatekey=tmp_ssh_priv_enc --from-file=ssh-publickey=tmp_ssh_pub_enc --dry-run=client -o yaml > data/infrastructure-hetzner/v1beta1/cluster-template-hetzner-secret.yaml
28 changes: 14 additions & 14 deletions test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@ e2e-ccm-templates:
cluster-templates: $(KUSTOMIZE) cluster-templates-v1beta1 ## Generate cluster templates for all versions

cluster-templates-v1beta1: $(KUSTOMIZE) ## Generate cluster templates for v1beta1
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-k8s-upgrade --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-k8s-upgrade.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-k8s-upgrade-kcp-scale-in --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-k8s-upgrade-kcp-scale-in.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-packer --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-packer.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-csr-off --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-csr-off.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-loadbalancer-off --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-loadbalancer-off.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-load-balancer-extra-services --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-load-balancer-extra-services.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-placement-groups --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-placement-groups.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-network --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-network.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-md-remediation.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-node-drain --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-node-drain.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-k8s-upgrade --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-k8s-upgrade.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-k8s-upgrade-kcp-scale-in --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-k8s-upgrade-kcp-scale-in.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-packer --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-packer.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-csr-off --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-csr-off.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-loadbalancer-off --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-loadbalancer-off.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-load-balancer-extra-services --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-load-balancer-extra-services.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-placement-groups --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hcloud-feature-placement-groups.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-network --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-network.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-md-remediation.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-node-drain --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-node-drain.yaml
HETZNER_SSH_PUB=$(HETZNER_SSH_PUB) HETZNER_SSH_PRIV=$(HETZNER_SSH_PRIV) ../../hack/ci-hetzner-secret.sh
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hetzner-baremetal --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' | sed 's/robot-user_secret_placeholder/$(shell echo -n "$(HETZNER_ROBOT_USER)" | base64 | tr -d '\n')/' | sed 's/robot-password_secret_placeholder/$(shell echo -n "$(HETZNER_ROBOT_PASSWORD)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hetzner-baremetal.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hetzner-baremetal-feature-raid-setup --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell echo -n "$(HCLOUD_TOKEN)" | base64 | tr -d '\n')/' | sed 's/robot-user_secret_placeholder/$(shell echo -n "$(HETZNER_ROBOT_USER)" | base64 | tr -d '\n')/' | sed 's/robot-password_secret_placeholder/$(shell echo -n "$(HETZNER_ROBOT_PASSWORD)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hetzner-baremetal-feature-raid-setup.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hetzner-baremetal --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' | sed 's/robot-user_secret_placeholder/$(shell echo -n "$(HETZNER_ROBOT_USER)" | base64 | tr -d '\n')/' | sed 's/robot-password_secret_placeholder/$(shell echo -n "$(HETZNER_ROBOT_PASSWORD)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hetzner-baremetal.yaml
$(KUSTOMIZE) build $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hetzner-baremetal-feature-raid-setup --load-restrictor LoadRestrictionsNone | sed 's/hcloud_secret_placeholder/$(shell printf "%s" $(HCLOUD_TOKEN) | base64 | tr -d '\n')/' | sed 's/robot-user_secret_placeholder/$(shell echo -n "$(HETZNER_ROBOT_USER)" | base64 | tr -d '\n')/' | sed 's/robot-password_secret_placeholder/$(shell echo -n "$(HETZNER_ROBOT_PASSWORD)" | base64 | tr -d '\n')/' > $(HETZNER_TEMPLATES)/v1beta1/cluster-template-hetzner-baremetal-feature-raid-setup.yaml


## --------------------------------------
Expand Down

0 comments on commit 7bb3027

Please sign in to comment.