-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 56a2096
Showing
5 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Publish deployment to kuraka | ||
|
||
TBD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |