diff --git a/.github/workflows/pr-minikube.yaml b/.github/workflows/pr-minikube.yaml index 4b6a0af4..917f424d 100644 --- a/.github/workflows/pr-minikube.yaml +++ b/.github/workflows/pr-minikube.yaml @@ -1,6 +1,7 @@ name: CI-Minikube on: - - pull_request + workflow_dispatch: +# - pull_request env: ACTIONS_RUNNER_DEBUG: true KUBEPLUS_TEST_OUTPUT: yes diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 43fb653d..39d63478 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,10 +1,10 @@ name: CI on: -# pull_request: workflow_dispatch: -# push: -# branches: -# - master + pull_request: + push: + branches: + - master env: ACTIONS_RUNNER_DEBUG: true KUBEPLUS_TEST_OUTPUT: yes diff --git a/deploy/Dockerfile.kubeconfiggenerator b/deploy/Dockerfile.kubeconfiggenerator index 5f521217..a6dce062 100644 --- a/deploy/Dockerfile.kubeconfiggenerator +++ b/deploy/Dockerfile.kubeconfiggenerator @@ -1,25 +1,38 @@ FROM ubuntu:20.04 + USER root -RUN apt-get update && apt-get upgrade && apt-get install -y curl openssl jq python3 python3-pip wget ca-certificates && pip3 install pyyaml -#COPY kubectl /root/ + +# Update, install dependencies, and clean up apt cache +RUN apt-get update && apt-get upgrade -y + +RUN apt-get install -y --no-install-recommends curl openssl jq python3 python3-pip wget ca-certificates + +RUN rm -rf /var/lib/apt/lists/* + +RUN pip3 install pyyaml + +# Copy files to the image COPY kubeconfiggenerator.py /root/. COPY kubeconfiggenerator.sh /root/. ADD requirements.txt /root/requirements.txt -RUN cd /root; pip3 install -r requirements.txt -#RUN cp /root/kubectl bin/. && chmod +x /root/kubectl && chmod +x bin/kubectl && -RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -RUN install -o root -g root -m 0755 kubectl bin/kubectl -RUN cp bin/kubectl /root/kubectl -RUN chmod +x /root/kubectl && chmod +x bin/kubectl -RUN chmod +x /root/kubeconfiggenerator.sh -RUN wget https://get.helm.sh/helm-v3.12.1-linux-amd64.tar.gz \ - && gunzip helm-v3.12.1-linux-amd64.tar.gz \ - && tar -xvf helm-v3.12.1-linux-amd64.tar \ - && mv linux-amd64/helm bin/. +# Install Python dependencies +RUN cd /root && pip3 install -r requirements.txt + +# Install kubectl and clean up +RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \ + install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \ + rm kubectl -#ENTRYPOINT ["/root/kubeconfiggenerator.sh"] +# Set executable permissions for scripts +RUN chmod +x /root/kubeconfiggenerator.sh /root/kubeconfiggenerator.py +# Install Helm, clean up tar files +RUN wget https://get.helm.sh/helm-v3.12.1-linux-amd64.tar.gz && \ + tar -xzf helm-v3.12.1-linux-amd64.tar.gz && \ + mv linux-amd64/helm /usr/local/bin/helm && \ + rm -rf helm-v3.12.1-linux-amd64.tar.gz linux-amd64 + +# Set default command to run the Python script EXPOSE 5005 CMD ["python3", "/root/kubeconfiggenerator.py"] - diff --git a/deploy/build-artifact-kubeconfiggenerator.sh b/deploy/build-artifact-kubeconfiggenerator.sh index 8e3b6454..5a88bf16 100755 --- a/deploy/build-artifact-kubeconfiggenerator.sh +++ b/deploy/build-artifact-kubeconfiggenerator.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Exit on error +set -e + if (( $# < 1 )); then echo "./build-artifact-kubeconfiggenerator.sh " fi diff --git a/install.sh b/install.sh index 84cf9143..690c355f 100755 --- a/install.sh +++ b/install.sh @@ -98,6 +98,7 @@ if $INSTALL_KUBEPLUS; then exit 1 fi echo "Waiting for KubePlus to start.." + kubectl get pods --namespace $KUBEPLUS_NAMESPACE sleep 1 elapsed=$((elapsed + 1)) done