-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support application base path, add Docker build scripts (#15)
* Configure pipeline for ssi * prepare pipeline * uppercase creds * set namespace for rollout and service cmd * correct ports * use value from secret * secret at correct place * use value from secret * use similar protocol * use https protocol * use correct port * different application host * add servers test * more tracing test * add servers test * add relative path to server * remove unused env var * set correct branches * update readme * undo changes cargo * improve docs * set url instead of host * add base path + url * clean env variables to create consistent test behaviour * automatically build docker * disable restart always * only manual dispatch workflow * fix: remove `init_env_vars` * added tests for AddFunctions url * remove return * Add simple changelog * Add simple changelog * implement feedback * improve add functions url * add clippy feedback * implement feedback * chore: extract cloud config values to env variables * fix: error message when BASE_PATH is not set --------- Co-authored-by: nanderstabel <nander.stabel@impierce.com> Co-authored-by: Daniel Mader <daniel.mader@impierce.com>
- Loading branch information
1 parent
dff1df7
commit 4f54df6
Showing
22 changed files
with
354 additions
and
42 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
AGENT_CONFIG_LOG_FORMAT=json | ||
AGENT_CONFIG_EVENT_STORE=postgres | ||
AGENT_APPLICATION_HOST=my-domain.example.org | ||
AGENT_APPLICATION_URL=https://my-domain.example.org | ||
AGENT_ISSUANCE_CREDENTIAL_NAME="Demo Credential" | ||
AGENT_ISSUANCE_CREDENTIAL_LOGO_URL=https://my-domain.example.org/credential_logo.png | ||
AGENT_STORE_DB_CONNECTION_STRING=postgresql://demo_user:demo_pass@localhost:5432/demo |
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,67 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# GitHub recommends pinning actions to a commit SHA. | ||
# To get a newer version, you will need to update the SHA. | ||
# You can also reference a tag or branch, but the action may change without warning. | ||
|
||
name: Build and Deploy to GKE | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
IMAGE: unicore | ||
|
||
jobs: | ||
setup-build-publish-deploy: | ||
name: Setup, Build, Publish, and Deploy | ||
runs-on: ubuntu-latest | ||
environment: dev | ||
env: | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
|
||
permissions: | ||
contents: "read" | ||
id-token: "write" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Auth" | ||
uses: "google-github-actions/auth@v2" | ||
with: | ||
token_format: "access_token" | ||
workload_identity_provider: projects/${{ secrets.PROJECT_NR }}/locations/global/workloadIdentityPools/workload-ip/providers/workload-ip-provider | ||
service_account: k8s-user@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com | ||
|
||
- name: "Set up Cloud SDK" | ||
uses: "google-github-actions/setup-gcloud@v2" | ||
|
||
- name: "Use gcloud CLI" | ||
run: "gcloud info" | ||
|
||
- name: Build | ||
working-directory: ".pipeline" | ||
run: chmod u+x ./build.sh && ./build.sh | ||
|
||
# Get the GKE credentials so we can deploy to the cluster | ||
- uses: google-github-actions/get-gke-credentials@v2 | ||
with: | ||
cluster_name: ${{ vars.GKE_CLUSTER_NAME }} | ||
project_id: ${{ secrets.PROJECT_ID }} | ||
location: ${{ vars.GKE_COMPUTE_ZONE }} | ||
|
||
- name: Create secret | ||
run: | | ||
kubectl -n ingress-apisix delete secret unicore-db-secret --ignore-not-found | ||
kubectl -n ingress-apisix create secret generic unicore-db-secret \ | ||
--from-literal='connection-string=${{ secrets.AGENT_STORE_DB_CONNECTION_STRING }}' | ||
## Deploy the Docker image to the GKE cluster | ||
- name: Deploy | ||
working-directory: ".pipeline" | ||
run: chmod u+x ./deploy.sh && ./deploy.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 @@ | ||
build/ |
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,14 @@ | ||
# Pipeline | ||
|
||
In order to run the pipeline build script locally, create a `.env` file in `.github/.pipeline` and add the following content: | ||
|
||
```sh | ||
IMAGE=unicore | ||
ARTIFACT_REGISTRY_HOST=<ask-the-repository-owner> | ||
ARTIFACT_REGISTRY_REPOSITORY=<ask-the-repository-owner> | ||
PROJECT_ID=<ask-the-repository-owner> | ||
GITHUB_SHA=test_sha | ||
APISIX_PATH=unicore | ||
``` | ||
|
||
Then execute `./build.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,47 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
[ -z "$IMAGE" ] && echo "Need to set IMAGE" && exit 1; | ||
[ -z "$ARTIFACT_REGISTRY_HOST" ] && echo "Need to set ARTIFACT_REGISTRY_HOST" && exit 1; | ||
[ -z "$ARTIFACT_REGISTRY_REPOSITORY" ] && echo "Need to set ARTIFACT_REGISTRY_REPOSITORY" && exit 1; | ||
[ -z "$PROJECT_ID" ] && echo "Need to set PROJECT_ID" && exit 1; | ||
[ -z "$GITHUB_SHA" ] && echo "Need to set GITHUB_SHA" && exit 1; | ||
|
||
export CONTAINER_REPO="$ARTIFACT_REGISTRY_HOST/$PROJECT_ID/$ARTIFACT_REGISTRY_REPOSITORY" | ||
|
||
echo $CONTAINER_REPO | ||
|
||
# Configure Docker to use the gcloud command-line tool as a credential | ||
# helper for authentication | ||
gcloud auth configure-docker $ARTIFACT_REGISTRY_HOST | ||
|
||
[ -e build/ ] && rm -rf build | ||
|
||
echo "-------------------------------------------------------------" | ||
echo "Create build directory" | ||
echo "-------------------------------------------------------------" | ||
|
||
mkdir build && cp *.yaml build && cd build | ||
|
||
echo "-------------------------------------------------------------" | ||
echo "Replace environment variables in files" | ||
echo "-------------------------------------------------------------" | ||
|
||
sed -i -e 's|@IMAGE@|'"$IMAGE"'|g' *.yaml | ||
sed -i -e 's|@CONTAINER_REPO@|'"$CONTAINER_REPO/$IMAGE:$GITHUB_SHA"'|g' *.yaml | ||
|
||
echo "-------------------------------------------------------------" | ||
echo "Display yaml files" | ||
echo "-------------------------------------------------------------" | ||
|
||
for f in *.yaml; do printf "\n---\n"; cat "${f}"; done | ||
|
||
cd ../../agent_application | ||
|
||
echo "-------------------------------------------------------------" | ||
echo "Build and push docker container" | ||
echo "-------------------------------------------------------------" | ||
|
||
docker build -t "$CONTAINER_REPO/$IMAGE:$GITHUB_SHA" -f docker/Dockerfile .. | ||
docker push "$CONTAINER_REPO/$IMAGE:$GITHUB_SHA" |
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,4 @@ | ||
### 24-01-2024 | ||
|
||
Environment variable `AGENT_APPLICATION_HOST` has changed to `AGENT_APPLICATION_URL` and requires the complete URL. e.g.: | ||
`https://my.domain.com/unicore`. In case you don't have rewrite root enabled on your reverse proxy, you will have to set `AGENT_CONFIG_BASE_PATH` as well. e.g.: `unicore`. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.