-
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.
Replace most github actions with scripts
- Loading branch information
Jason Lubken
committed
Sep 20, 2024
1 parent
4f3d2eb
commit a93a3dd
Showing
13 changed files
with
218 additions
and
187 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,5 +1,4 @@ | ||
{% raw %}name: release | ||
|
||
on: | ||
release: | ||
types: | ||
|
@@ -15,39 +14,39 @@ jobs: | |
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: publish | ||
id: publish | ||
uses: pennsignals/[email protected] | ||
with: | ||
docker_compose: "docker-compose.yml" | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
- id: version | ||
run: | | ||
version=$(./scripts/version.sh) | ||
echo "version = ${version}" | ||
echo "version=${version}" >> $GITHUB_OUTPUT | ||
|
||
- id: publish | ||
run: | | ||
./scripts/publish.sh -b true -p "${{ secrets.GITHUB_TOKEN }}" -v "${{ steps.version.outputs.version }}" | ||
|
||
staging: | ||
evaluation: | ||
if: ${{ github.event.release.prerelease }} | ||
needs: publish | ||
runs-on: [self-hosted, nomad, azure, staging] | ||
runs-on: [evaluation, self-hosted, nomad, azure] | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Deploy pre-release to staging | ||
- name: staging_consul | ||
uses: pennsignals/[email protected] | ||
with: | ||
addr: "${{ secrets.STAGING_CONSUL_ADDR }}" | ||
config: "./local/deploy_config.yml" | ||
env: "staging" | ||
|
||
- name: staging_deploy | ||
uses: pennsignals/[email protected] | ||
with: | ||
version: "${{ needs.publish.outputs.tag }}" | ||
config: "./local/deploy_config.yml" | ||
nomad_addr: "${{ secrets.STAGING_NOMAD_ADDR }}" | ||
|
||
- name: tar | ||
run: tar -czvf nomad.tar.gz nomad/ | ||
# Deploy configuration | ||
- id: consul | ||
run: | | ||
./scripts/consul.sh \ | ||
--src ./predict/local/configuration.yaml \ | ||
--dst pennsignals/palliativeconnect/predict/configuration.yaml | ||
|
||
# Deploy jobs | ||
- id: nomad | ||
run: | | ||
./scripts/nomad.sh \ | ||
--src ./predict/nomad \ | ||
--dst ./nomad \ | ||
--version "${{ needs.publish.outputs.version }}" | ||
|
||
# Upload rendered nomad jobs as artifacts | ||
- name: upload | ||
|
@@ -74,23 +73,20 @@ jobs: | |
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Deploy main release to Production | ||
- name: production_consul | ||
uses: pennsignals/[email protected] | ||
with: | ||
addr: "${{ secrets.PRODUCTION_CONSUL_ADDR }}" | ||
config: "./local/deploy_config.yml" | ||
env: "production" | ||
|
||
- name: production_deploy | ||
uses: pennsignals/[email protected] | ||
with: | ||
version: "${{ needs.publish.outputs.tag }}" | ||
config: "./local/deploy_config.yml" | ||
nomad_addr: "${{ secrets.PRODUCTION_NOMAD_ADDR }}" | ||
|
||
- name: tar | ||
run: tar -czvf nomad.tar.gz nomad/ | ||
# Deploy configuration | ||
- id: consul | ||
run: | | ||
./scripts/consul.sh \ | ||
--src ./predict/local/configuration.yaml \ | ||
--dst pennsignals/palliativeconnect/predict/configuration.yaml | ||
|
||
# Deploy jobs | ||
- id: nomad | ||
run: | | ||
./scripts/nomad.sh \ | ||
--src ./predict/nomad | ||
--dst ./nomad \ | ||
--version "${{ needs.publish.outputs.version }}" | ||
|
||
# Upload rendered nomad jobs as artifacts | ||
- name: upload | ||
|
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
function usage { | ||
echo "" | ||
echo "Consul configuration put." | ||
echo "" | ||
echo "usage: --src ./predict/local/configuration.yaml --dst organization/application/predict/configuration.yaml" | ||
echo "" | ||
echo " --src -s string path to configuration file" | ||
echo " --dst -d string path to consul kv" | ||
echo " --help -t Print usage and exit" | ||
echo "" | ||
} | ||
|
||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
-h|--help) | ||
usage | ||
exit 0 | ||
;; | ||
-d|--dst) | ||
dst="$2" | ||
;; | ||
-s|--src) | ||
src="$2" | ||
;; | ||
*) | ||
invalid_parameter $1 | ||
esac | ||
shift | ||
shift | ||
done | ||
|
||
consul kv put ${dst} @${src} |
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,54 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
function usage { | ||
echo "" | ||
echo "Publish labeled images from docker compose." | ||
echo "" | ||
echo "usage: --src -s ./predict/nomad --dst -d ./nomad" | ||
echo "" | ||
echo " --src -s string Source directory for nomad files" | ||
echo " --dst -d string Destination for rendered nomad files" | ||
echo " --version -v string version" | ||
echo " (example: 4.0.0-rc.1)" | ||
echo " --help -h Print usage and exit" | ||
echo "" | ||
} | ||
|
||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
-h|--help) | ||
usage | ||
exit 0 | ||
;; | ||
-s|--src) | ||
src="$2" | ||
;; | ||
-d|--dst) | ||
dst="$2" | ||
;; | ||
-v|--version) | ||
version="$2" | ||
;; | ||
*) | ||
invalid_parameter $1 | ||
esac | ||
shift | ||
shift | ||
done | ||
|
||
echo "Deploying jobs from: ${src}" | ||
for file in ${src}/*.nomad.hcl; do | ||
name="$(basename ${file})" | ||
levant render -var version="${version}" -out="${dst}/${name}" ${file} | ||
done | ||
|
||
echo "Deploying jobs from: ${dst}." | ||
for file in ${src}/*.nomad.hcl; do | ||
levant deploy \ | ||
-address http://nomad.service.consul:4646 \ | ||
-var version="${version}" \ | ||
-ignore-no-changes ${file} | ||
done | ||
|
||
tar -czvf nomad.tar.gz ${dst} |
Oops, something went wrong.