mirror of
https://gitea.com/gitea/helm-actions.git
synced 2026-07-17 19:54:45 +00:00
Compare commits
1 Commits
christophe
...
d761df11a2
| Author | SHA1 | Date | |
|---|---|---|---|
| d761df11a2 |
@ -1,76 +0,0 @@
|
|||||||
on: pull_request
|
|
||||||
jobs:
|
|
||||||
k8s-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
CLUSTER_NAME: test-cluster
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Docker CLI, kind, and kubectl
|
|
||||||
run: |
|
|
||||||
# Install Docker CLI (to talk to the host daemon via the mounted socket)
|
|
||||||
apt-get update && apt-get install -y docker.io jq
|
|
||||||
|
|
||||||
# Install kind
|
|
||||||
curl -Lo /usr/local/bin/kind https://kind.sigs.k8s.io/dl/v0.24.0/kind-linux-amd64
|
|
||||||
chmod +x /usr/local/bin/kind
|
|
||||||
|
|
||||||
# Install kubectl
|
|
||||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
|
||||||
install kubectl /usr/local/bin/
|
|
||||||
|
|
||||||
- name: Create kind cluster
|
|
||||||
run: |
|
|
||||||
kind delete cluster test-cluster2
|
|
||||||
|
|
||||||
docker inspect ${CLUSTER_NAME}-control-plane && mkdir -p ~/.kube && kind get kubeconfig --name ${CLUSTER_NAME} > ~/.kube/config || kind create cluster --name ${CLUSTER_NAME} --wait 5m
|
|
||||||
|
|
||||||
- name: Connect kind to the job container's network and fix kubeconfig
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
# 1. Find the Docker network the job container is on
|
|
||||||
# The job container's hostname is the container ID
|
|
||||||
JOB_CONTAINER_ID=$(hostname)
|
|
||||||
NETWORK_NAME=$(docker inspect "$JOB_CONTAINER_ID" \
|
|
||||||
--format '{{range $k, $v := .NetworkSettings.Networks}}{{$k}}{{end}}')
|
|
||||||
|
|
||||||
echo "NETWORK_NAME=$NETWORK_NAME" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
echo "Job container network: $NETWORK_NAME"
|
|
||||||
|
|
||||||
# 2. Get the kind control-plane container name
|
|
||||||
KIND_CONTAINER="${CLUSTER_NAME}-control-plane"
|
|
||||||
|
|
||||||
echo "KIND_CONTAINER=$KIND_CONTAINER" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# 3. Connect the kind container to the same network
|
|
||||||
docker network connect "$NETWORK_NAME" "$KIND_CONTAINER"
|
|
||||||
|
|
||||||
# 4. Get the kind container's IP on that network
|
|
||||||
KIND_IP=$(docker inspect "$KIND_CONTAINER" \
|
|
||||||
--format "{{(index .NetworkSettings.Networks \"$NETWORK_NAME\").IPAddress}}")
|
|
||||||
|
|
||||||
echo "Kind container IP on shared network: $KIND_IP"
|
|
||||||
|
|
||||||
# 5. Rewrite the kubeconfig to use the kind container's IP
|
|
||||||
# kind's API server listens on port 6443 inside the container
|
|
||||||
kubectl config set-cluster kind-${CLUSTER_NAME} \
|
|
||||||
--server="https://${KIND_IP}:6443"
|
|
||||||
|
|
||||||
# 6. Since the TLS cert won't match the new IP, use insecure mode
|
|
||||||
# OR set insecure-skip-tls-verify
|
|
||||||
kubectl config set-cluster kind-${CLUSTER_NAME} \
|
|
||||||
--insecure-skip-tls-verify=true
|
|
||||||
|
|
||||||
- name: Verify cluster access
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
kubectl cluster-info
|
|
||||||
kubectl get nodes
|
|
||||||
kubectl get pods -A
|
|
||||||
|
|
||||||
- name: Disconnect Kind Network
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
docker network disconnect "$NETWORK_NAME" "$KIND_CONTAINER"
|
|
||||||
@ -35,7 +35,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Import GPG key
|
- name: Import GPG key
|
||||||
id: import_gpg
|
id: import_gpg
|
||||||
uses: https://github.com/crazy-max/ghaction-import-gpg@v7
|
uses: https://github.com/crazy-max/ghaction-import-gpg@v6
|
||||||
with:
|
with:
|
||||||
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
|
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
|
||||||
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
||||||
|
|||||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@ -181,8 +181,8 @@ packages:
|
|||||||
lodash@4.17.23:
|
lodash@4.17.23:
|
||||||
resolution: {integrity: sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==}
|
resolution: {integrity: sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==}
|
||||||
|
|
||||||
markdown-it@14.1.0:
|
markdown-it@14.1.1:
|
||||||
resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==}
|
resolution: {integrity: sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
markdown-table@2.0.0:
|
markdown-table@2.0.0:
|
||||||
@ -478,7 +478,7 @@ snapshots:
|
|||||||
|
|
||||||
lodash@4.17.23: {}
|
lodash@4.17.23: {}
|
||||||
|
|
||||||
markdown-it@14.1.0:
|
markdown-it@14.1.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
argparse: 2.0.1
|
argparse: 2.0.1
|
||||||
entities: 4.5.0
|
entities: 4.5.0
|
||||||
@ -499,7 +499,7 @@ snapshots:
|
|||||||
js-yaml: 4.1.1
|
js-yaml: 4.1.1
|
||||||
jsonc-parser: 3.3.1
|
jsonc-parser: 3.3.1
|
||||||
jsonpointer: 5.0.1
|
jsonpointer: 5.0.1
|
||||||
markdown-it: 14.1.0
|
markdown-it: 14.1.1
|
||||||
markdownlint: 0.40.0
|
markdownlint: 0.40.0
|
||||||
minimatch: 10.1.2
|
minimatch: 10.1.2
|
||||||
run-con: 1.3.2
|
run-con: 1.3.2
|
||||||
|
|||||||
Reference in New Issue
Block a user