Compare commits

17 Commits

Author SHA1 Message Date
nate.lubitz 5d257a786e validate false
Publish Action Image / build (push) Successful in 28s
2026-06-05 17:07:33 +10:00
nate.lubitz 1d19b08b7e add security scans
Publish Action Image / build (push) Successful in 1m9s
2026-06-05 17:02:41 +10:00
nate.lubitz 70593fe0a3 missing dot
Publish Action Image / build (push) Successful in 28s
2026-06-05 16:58:57 +10:00
nate.lubitz f02cf329d6 skip regcred
Publish Action Image / build (push) Successful in 27s
2026-06-05 16:55:58 +10:00
nate.lubitz 4ed2e2c8b1 add validate false flag
Publish Action Image / build (push) Successful in 34s
2026-06-05 16:54:25 +10:00
nate.lubitz 115484ce0d too many added
Publish Action Image / build (push) Successful in 29s
2026-06-05 16:51:40 +10:00
nate.lubitz 95ef2f8a28 just use insecure flag
Publish Action Image / build (push) Successful in 29s
2026-06-05 16:49:47 +10:00
nate.lubitz 747d22f8be Update entrypoint.sh
Publish Action Image / build (push) Successful in 39s
2026-06-04 18:39:13 +00:00
nate.lubitz f09a243d8a wrong side validate
Publish Action Image / build (push) Successful in 37s
2026-06-05 04:34:06 +10:00
nate.lubitz 986863b064 disable verify tls
Publish Action Image / build (push) Successful in 37s
2026-06-05 04:30:17 +10:00
nate.lubitz da774ae051 validate false
Publish Action Image / build (push) Successful in 39s
2026-06-05 04:23:46 +10:00
nate.lubitz dd781f4cd6 move cleanup
Publish Action Image / build (push) Successful in 49s
2026-06-05 04:17:30 +10:00
nate.lubitz 15551103ec cert debugging
Publish Action Image / build (push) Successful in 43s
2026-06-05 04:13:57 +10:00
nate.lubitz 8f13825087 typo
Publish Action Image / build (push) Successful in 34s
2026-06-05 04:07:46 +10:00
nate.lubitz 5a0505a9ea remove bash, make temp file
Publish Action Image / build (push) Failing after 34s
2026-06-05 04:05:00 +10:00
nate.lubitz 188453d534 use bash instead
Publish Action Image / build (push) Successful in 1m22s
2026-06-05 03:59:20 +10:00
nate.lubitz 699a2ddd2c add docker-cli
Publish Action Image / build (push) Successful in 1m33s
2026-06-05 03:46:56 +10:00
3 changed files with 49 additions and 11 deletions
+4 -2
View File
@@ -5,9 +5,11 @@ RUN go build -o kforge .
FROM alpine:3.19
COPY --from=builder /app/kforge /usr/local/bin/kforge
RUN apk add --no-cache curl && \
RUN apk add --no-cache curl docker-cli && \
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
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
+9
View File
@@ -40,6 +40,15 @@ inputs:
description: "Kubernetes service account token"
required: true
scan_image:
description: "Scan image for vulnerabilities before pushing"
required: false
default: "true"
scan_severity:
description: "Fail on these severity levels (UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL)"
required: false
default: "HIGH,CRITICAL"
# outputs:
# output_file:
# description: "Path to the generated Kubernetes YAML file"
+36 -9
View File
@@ -67,6 +67,15 @@ if [ -n "$INPUT_IMAGE_NAME" ]; then
if [ -n "$INPUT_IMAGE_TAG" ]; then
echo "Building image $FULL_IMAGE:$INPUT_IMAGE_TAG..."
docker build -t "$FULL_IMAGE:$INPUT_IMAGE_TAG" -f "$INPUT_DOCKERFILE" .
echo "Scanning image for vulnerabilities..."
trivy image \
--exit-code 1 \
--severity "$INPUT_SCAN_SEVERITY" \
--no-progress \
"$FULL_IMAGE:$INPUT_IMAGE_TAG"
echo "Scan passed, pushing image..."
docker push "$FULL_IMAGE:$INPUT_IMAGE_TAG"
else
SHA=$(echo "$GITHUB_SHA" | cut -c1-7)
@@ -75,6 +84,15 @@ if [ -n "$INPUT_IMAGE_NAME" ]; then
-t "$FULL_IMAGE:latest" \
-t "$FULL_IMAGE:$SHA" \
-f "$INPUT_DOCKERFILE" .
echo "Scanning image for vulnerabilities..."
trivy image \
--exit-code 1 \
--severity "$INPUT_SCAN_SEVERITY" \
--no-progress \
"$FULL_IMAGE:latest"
echo "Scan passed, pushing image..."
docker push "$FULL_IMAGE:latest"
docker push "$FULL_IMAGE:$SHA"
@@ -93,9 +111,15 @@ echo "Generating Kubernetes YAML from .kforge.yml"
# ----------------------------------------------------------------
# Build kubeconfig from token-based credentials
echo "Configuring kubectl..."
# Try writing the cert and check if it worked
echo "$INPUT_KUBE_CERTIFICATE" | base64 -d > /tmp/kube-ca.crt 2>&1
echo "Cert file size: $(wc -c < /tmp/kube-ca.crt)"
echo "Cert file contents: $(cat /tmp/kube-ca.crt | head -1)"
kubectl config set-cluster default \
--server="$INPUT_KUBE_HOST" \
--certificate-authority=<(echo "$INPUT_KUBE_CERTIFICATE" | base64 -d)
--certificate-authority=/tmp/kube-ca.crt
kubectl config set-credentials default \
--token="$INPUT_KUBE_TOKEN"
@@ -106,14 +130,17 @@ kubectl config set-context default \
kubectl config use-context default
# Create/update regcred secret idempotently
echo "Creating regcred secret..."
kubectl create secret docker-registry regcred \
--docker-server="$INPUT_REGISTRY" \
--docker-username="$INPUT_REGISTRY_USERNAME" \
--docker-password="$INPUT_REGISTRY_PASSWORD" \
--dry-run=client -o yaml | kubectl apply -f -
# echo "Creating regcred secret..."
# kubectl create secret docker-registry regcred \
# --docker-server="$INPUT_REGISTRY" \
# --docker-username="$INPUT_REGISTRY_USERNAME" \
# --docker-password="$INPUT_REGISTRY_PASSWORD" \
# --dry-run=client -o yaml | kubectl apply -f - --insecure-skip-tls-verify --validate=false
echo "Deploying to Kubernetes..."
kubectl apply -f ./kforge-out/
echo "Deploy complete."
kubectl apply --insecure-skip-tls-verify --validate=false -f ./.kforge-out/
echo "Deploy complete."
echo "Cleanup"
rm -f /tmp/kube-ca.crt