Initial commit

This commit is contained in:
2024-12-07 15:44:48 +01:00
commit 0d3e37bfe0
4 changed files with 45 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.idea

11
Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM public.ecr.aws/docker/library/node:22-alpine3.20
# Install git for gitea actions and ansible
RUN apk add --no-cache git kubectl bash
WORKDIR /usr/src
COPY entrypoint.sh .
RUN chmod +x /usr/src/entrypoint.sh
ENTRYPOINT ["bash","-c","/usr/src/entrypoint.sh"]

13
action.yml Normal file
View File

@@ -0,0 +1,13 @@
name: Restart kube apps
description: Permits restarting a deployed kube-app when an update is pushed
author: Skydust
# Define your inputs here.
inputs:
deploymentName:
description: The deployment name
required: true
runs:
using: docker
image: Dockerfile

20
entrypoint.sh Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
INPUT_DEPLOYMENT_NAME=$deploymentName
set -e
echo "Searching kubectl rights in env: KUBERNETES_BASE64_CONF"
if [[ -z "$KUBERNETES_BASE64_CONF" ]]; then
echo "No kubernetes config found."
echo "Encode it in base64 and place it in gitea secrets"
fi
echo "$KUBERNETES_BASE64_CONF" | base64 -d > "/root/.kube/config"
KUBECTL_OPTIONS+=("rollout" "restart" "deployment/${INPUT_DEPLOYMENT_NAME}")
# shellcheck disable=SC2145
echo "Running kubectl with options: ${KUBECTL_OPTIONS[@]}"
kubectl ${KUBECTL_OPTIONS[@]}
exit 0