-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use pattern to update images for release pipline.
Test both UI and API when verifying deployed version. run integration tests after deploy to staging run deploy to prod after integration tests
- Loading branch information
Showing
4 changed files
with
101 additions
and
26 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 |
---|---|---|
|
@@ -10,8 +10,8 @@ on: | |
description: 'The image to update' | ||
type: string | ||
required: true | ||
health-endpoint: | ||
description: 'The health endpoint to check' | ||
deploy-domain: | ||
description: 'The domain to check for deployment' | ||
type: string | ||
required: true | ||
k8s-environment: | ||
|
@@ -25,11 +25,11 @@ on: | |
type: string | ||
required: true | ||
image: | ||
description: 'The image to update' | ||
description: 'The image to update, can use * to update all images' | ||
type: string | ||
required: true | ||
health-endpoint: | ||
description: 'The health endpoint to check' | ||
deploy-domain: | ||
description: 'The domain to check for deployment' | ||
type: string | ||
required: true | ||
k8s-environment: | ||
|
@@ -42,6 +42,12 @@ jobs: | |
# deploy checks out the fleet repo, we don't want more than one just running at once to avoid conflicts | ||
concurrency: deploy | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: ${{ inputs.k8s-environment }} | ||
url: https://${{ inputs.deploy-domain }} | ||
outputs: | ||
api-version: ${{ steps.get-api-version.outputs.result }} | ||
ui-version: ${{ steps.get-ui-version.outputs.result }} | ||
steps: | ||
- name: Checkout lexbox repo | ||
uses: actions/checkout@v3 | ||
|
@@ -64,23 +70,44 @@ jobs: | |
- name: Update image version in fleet kustomization.yaml | ||
uses: mikefarah/[email protected] | ||
with: | ||
cmd: yq eval -i '(.images.[] | select(.name == "${{ inputs.image }}").newTag) = "${{ inputs.version }}"' "fleet/languageforge-lexbox/kustomization.yaml" | ||
cmd: yq eval -i '(.images.[] | select(.name == "${{ inputs.image }}").newTag) = "${{ inputs.version }}"' "fleet/${{ inputs.k8s-environment }}/kustomization.yaml" | ||
- name: Get API version | ||
uses: mikefarah/[email protected] | ||
id: get-api-version | ||
with: | ||
cmd: yq '.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-api").newTag' "fleet/${{ inputs.k8s-environment }}/kustomization.yaml" | ||
- name: Get UI version | ||
uses: mikefarah/[email protected] | ||
id: get-ui-version | ||
with: | ||
cmd: yq '.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-ui").newTag' "fleet/${{ inputs.k8s-environment }}/kustomization.yaml" | ||
- name: Push to fleet repo | ||
uses: EndBug/add-and-commit@v9 #https://github.com/EndBug/add-and-commit | ||
with: | ||
default_author: github_actions | ||
message: "[Lexbox] Update ${{ inputs.k8s-environment }} image: ${{ inputs.image }} to ${{ inputs.version }}" | ||
cwd: './fleet/' | ||
add: 'languageforge-lexbox/*' | ||
push: true | ||
add: '${{ inputs.k8s-environment }}/*' | ||
push: false | ||
verify-published: | ||
name: Verify ${{ matrix.verify.name }} Published | ||
runs-on: ubuntu-latest | ||
needs: deploy | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
verify: | ||
- version: ${{ needs.deploy.outputs.api-version }} | ||
endpoint: ${{ inputs.deploy-domain }}/api/healthz | ||
name: API | ||
- version: ${{ needs.deploy.outputs.ui-version }} | ||
endpoint: ${{ inputs.deploy-domain }}/healthz | ||
name: UI | ||
steps: | ||
- name: Verify Version | ||
env: | ||
TARGET_ENDPOINT: ${{ inputs.health-endpoint }} | ||
EXPECTED_VERSION: ${{ inputs.version }} | ||
TARGET_ENDPOINT: ${{ matrix.verify.endpoint }} | ||
EXPECTED_VERSION: ${{ matrix.verify.version }} | ||
run: | | ||
IterateCount=10 | ||
DelayMultiplier=5 | ||
|
@@ -95,8 +122,6 @@ jobs: | |
exit 0 | ||
else | ||
echo "Version '$versionHeader' is incorrect, expected '$EXPECTED_VERSION'" | ||
echo "response was:" | ||
cat response.txt | ||
n=$((n+1)) | ||
sleep $((DelayMultiplier * n)) | ||
fi | ||
|
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