Some checks failed
Setup Stackit CLI / Install and Use Stackit CLI (push) Failing after 13s
73 lines
No EOL
2 KiB
YAML
73 lines
No EOL
2 KiB
YAML
name: Setup Stackit CLI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
|
|
jobs:
|
|
setup-stackit-cli:
|
|
name: Install and Use Stackit CLI
|
|
runs-on: docker-dind
|
|
|
|
env:
|
|
STACKIT_SERVICE_ACOUNT_KEY: ${{ secrets.STACKIT_SERVICE_ACOUNT_KEY }}
|
|
STACKIT_PROJECT_ID: ${{ secrets.STACKIT_PROJECT_ID }}
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download and Install Stackit CLI
|
|
run: |
|
|
# Define variables
|
|
VERSION="0.40.7"
|
|
BIN_DIR="/usr/local/bin"
|
|
DOWNLOAD_URL="https://github.com/stackitcloud/stackit-cli/releases/download/v${VERSION}/stackit-cli_${VERSION}_linux_amd64.tar.gz"
|
|
|
|
# Download and extract
|
|
curl -sSL "$DOWNLOAD_URL" | tar -xz
|
|
|
|
# Move CLI binary to PATH
|
|
mv stackit "$BIN_DIR/"
|
|
chmod +x "$BIN_DIR/stackit"
|
|
|
|
# Verify installation
|
|
stackit --version
|
|
shell: bash
|
|
|
|
- name: Install kubectl
|
|
run: |
|
|
# Get latest version
|
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
|
chmod +x kubectl
|
|
mv kubectl /usr/local/bin/kubectl
|
|
|
|
# Verify kubectl installation
|
|
kubectl version --client --output=yaml
|
|
shell: bash
|
|
|
|
- name: Authenticate with STACKIT
|
|
run: |
|
|
echo "$STACKIT_SERVICE_ACOUNT_KEY" > "$HOME/.stackit.json"
|
|
stackit auth activate-service-account --service-account-key-path "$HOME/.stackit.json"
|
|
shell: bash
|
|
|
|
- name: Set project config
|
|
run: |
|
|
stackit config set --project-id "$STACKIT_PROJECT_ID"
|
|
shell: bash
|
|
|
|
- name: Get Kubeconfig SKE Cluster
|
|
run: stackit ske kubeconfig create pocnc-k8s --assume-yes
|
|
shell: bash
|
|
|
|
- name: Kubectl apply all namespaces in root folder
|
|
run: kubectl apply -f .
|
|
shell: bash
|
|
|
|
- name: Cleanup
|
|
run: rm -f "$HOME/.stackit.json"
|
|
if: always()
|
|
shell: bash |