-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Server with metrics and health check ready
- Loading branch information
Christopher Kolstad
committed
Jan 19, 2023
1 parent
f858fea
commit 231efc3
Showing
20 changed files
with
2,908 additions
and
6 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,38 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
function script_echo() { | ||
echo "unleash-operator-rs: $1" | ||
} | ||
|
||
function generate_buildinfo() { | ||
output=${1} | ||
trigger_event=${2} | ||
self_git_sha=$(git rev-parse --short=7 HEAD) | ||
|
||
cat <<EOT > ${output} | ||
{ | ||
"commits": [ | ||
{ | ||
"slug": "Unleash/unleash-edge", | ||
"id": "${self_git_sha}" | ||
} | ||
], | ||
"project": "unleash-edge", | ||
"trigger": { | ||
"type": "commit", | ||
"source": "Unleash/unleash-operator-rs", | ||
"commitIds": ["${self_git_sha}"] | ||
}, | ||
"docker": { | ||
"image": "${DOCKER_IMAGE}", | ||
"tag": "sha-${self_git_sha}" | ||
}, | ||
"unixTimestamp": "$(date +%s)" | ||
} | ||
EOT | ||
} | ||
generate_buildinfo buildinfo.json | ||
script_echo "$(cat buildinfo.json)" | ||
|
||
curl -X POST -H "Content-Type: application/json" https://sandbox.getunleash.io/pipeline/build_info -d @buildinfo.json | ||
|
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 |
---|---|---|
@@ -1,2 +1,46 @@ | ||
--- | ||
name: Run Code quality checks on code (reporting to ) | ||
name: Clippy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
files: | ||
- '**.rs' | ||
- '**.toml' | ||
pull_request: | ||
branches: | ||
- main | ||
files: | ||
- '**.rs' | ||
- '**.toml' | ||
|
||
jobs: | ||
clippy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
security-events: write | ||
actions: read | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install rust | ||
run: | | ||
rustup set auto-self-update disable | ||
rustup toolchain install stable --profile default | ||
rustup show | ||
- name: Rust cache | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Install required cargo packages for reporting format | ||
run: cargo install clippy-sarif sarif-fmt | ||
- name: Run rust-clippy | ||
run: | | ||
cargo clippy --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt | ||
continue-on-error: true | ||
- name: Upload analysis results to Github | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: rust-clippy-results.sarif | ||
category: clippy | ||
wait-for-processing: true |
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,77 @@ | ||
--- | ||
name: Build docker image for aarch64 (ECR) | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
files: | ||
- '**.rs' | ||
- '**.toml' | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install rust | ||
run: | | ||
rustup set auto-self-update disable | ||
rustup toolchain install stable --profile default | ||
rustup show | ||
- name: Rust cache | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Install cross (cross compile) | ||
run: | | ||
cargo install cross | ||
- name: Build release | ||
run: | | ||
cross build --release --target=aarch64-unknown-linux-musl | ||
- name: Setup QEMU (to support multiplatform) | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Configure aws credentials | ||
uses: aws/actions/configure-aws-credentials@v1-node16 | ||
id: aws-eu-north | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-north-1 | ||
- name: Login to ECR | ||
id: login-ecr-eu-north | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
- name: Setup docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Docker meta configuration (set image and tag) | ||
uses: docker/metadata-action@v4 | ||
id: meta | ||
with: | ||
images: | | ||
${{ steps.login-ecr-eu-north.outputs.registry }}/unleash-edge | ||
tags: | | ||
type=ref,event=branch | ||
type=sha | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: Build tag and push image to Amazon ECR | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
platforms: linux/arm64 | ||
push: true | ||
labels: ${{ steps.meta.outputs.labels }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
notifypipeline: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
needs: docker | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Send to pipeline | ||
run: | | ||
bash ./.github/notify_pipeline.sh | ||
env: | ||
DOCKER_IMAGE: "726824350591.dkr.ecr.eu-north-1.amazonaws.com/unleash-edge" |
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,36 @@ | ||
name: Run cargo smart-release | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
bump_version: | ||
description: Which type of release would you like to make (patch, minor, major) | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
name: Checkout code | ||
with: | ||
token: ${{ secrets.GH_PUSH_TOKEN }} | ||
- name: setup git config | ||
run: | | ||
git config user.name "Github Release Bot" | ||
git config user.email "<>" | ||
- name: Install rust | ||
run: | | ||
rustup set auto-self-update disable | ||
rustup toolchain install stable --profile minimal | ||
rustup show | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Install cargo smart-release | ||
run: | | ||
cargo install cargo-smart-release | ||
- name: Run release | ||
run: | | ||
cargo smart-release -u -b ${{ github.event.inputs.bump_version }} --allow-fully-generated-changelog --no-changelog-preview --execute |
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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ debug/ | |
*.iml | ||
*.ipr | ||
*.iws | ||
./vscode | ||
|
||
.project | ||
.classpath | ||
|
Oops, something went wrong.