Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
erickgnavar committed May 21, 2024
0 parents commit 56a2096
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI

on: push

jobs:
run-linters:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Install shellcheck
run: sudo apt update && sudo apt install shellcheck --yes

- name: Run shellcheck
run: shellcheck entrypoint.sh
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM alpine:3.19

RUN apk --update add curl bash

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Publish deployment to kuraka

TBD
22 changes: 22 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: "Update kubernetes deployment image"
description: "Update kubernetes deployment image"
inputs:
project:
description: "Project code"
required: true
environment:
description: "Environment name"
required: true
image_version:
description: "Docker image tag name, {org}/{repo}:{tag}"
required: true
url:
description: "Publish endpoint, for example {host}/api/deployments"
required: true
token:
description: "Authentication token to be able to publish deployments"
required: true
runs:
using: "docker"
image: "Dockerfile"
29 changes: 29 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash -l
# exit on any error
set -e

PROJECT="${INPUT_PROJECT}"
ENVIRONMENT="${INPUT_ENVIRONMENT}"
IMAGE_VERSION="${INPUT_IMAGE_VERSION}"
GITHUB_USERNAME="${GITHUB_ACTOR}"
TOKEN="${INPUT_TOKEN}"
URL="${INPUT_URL}"

prepare_payload() {
cat <<EOF
{
"environment_type": "${ENVIRONMENT}",
"project_name": "${PROJECT}",
"image_version": "${IMAGE_VERSION}",
"github_username": "${GITHUB_USERNAME}"
}
EOF
}

response=$(curl -D headers.txt -X POST -H "Content-Type:application/json" -H "X-Api-Token:${TOKEN}" -d "$(prepare_payload)" "${URL}")

printf "HEADERS\n%s" "$(cat headers.txt)"

grep " 201" headers.txt || exit 1

echo "${response}"

0 comments on commit 56a2096

Please sign in to comment.