-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spike/multidev #402
Closed
Closed
Spike/multidev #402
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
073bc88
Spike: Test review apps
MatthewWilkes e9efbc4
Trigger update
MatthewWilkes 8036798
Use only not rules for external PRs
MatthewWilkes ba20836
Push tags
MatthewWilkes dc7ec00
Improve revision and db setup
MatthewWilkes 3e4926c
Remove review from revision name
MatthewWilkes a2ef677
Simplify slug environment
MatthewWilkes 6d28636
Update slug again
MatthewWilkes 07575f4
Trigger update
MatthewWilkes e1b37e3
Prevent deploy to old dev and pp when using review apps
MatthewWilkes 721fe14
Trigger pipeline
MatthewWilkes 1c8904d
Try github action
MatthewWilkes eebf0e2
Use ubuntu-latest runner
MatthewWilkes 844d78c
Env variable changes
MatthewWilkes 596d8a4
Env variable changes
MatthewWilkes 7820e02
Env variable changes
MatthewWilkes 5644e3f
Use login action
MatthewWilkes 2b869a7
Use login action
MatthewWilkes 011a626
Explicit sub
MatthewWilkes 8bd7b1d
Fix tag
MatthewWilkes 0192e75
Slugs
MatthewWilkes 5992025
Artificial delay
MatthewWilkes 57a7a04
Fix revision name
MatthewWilkes 22c312a
run name
MatthewWilkes 4b882aa
run name
MatthewWilkes 6c460c3
Trigger build
MatthewWilkes 5fb265b
Fix quoting error and disable gitlab external MR pipeline
MatthewWilkes 5c98c20
Fix gh in review app url
MatthewWilkes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,110 @@ | ||
name: Deploy review app | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
pr_commented: | ||
# This job only runs for pull request comments | ||
name: PR comment | ||
#if: ${{ github.event.issue.pull_request }} && contains(github.event.comment.body, '/deploy') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Log in to Azure | ||
uses: azure/login@v1 | ||
with: | ||
creds: '{"clientId":"${{ vars.ARM_CLIENT_ID }}","clientSecret":"${{ secrets.ARM_CLIENT_SECRET }}","subscriptionId":"${{ vars.ARM_SUBSCRIPTION_ID }}","tenantId":"${{ vars.ARM_TENANT_ID }}"}' | ||
|
||
- name: Deploy review app | ||
id: deploy | ||
env: | ||
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} | ||
REF_NAME: ${{ github.head_ref }} | ||
run: | | ||
CI_COMMIT_BRANCH="$REF_NAME" | ||
ENV_SLUG=$(echo "${REF_NAME}" | sed -e 's:[^[:alpha:]|^[:digit:]]:-:g' | sed -e 's/\(.*\)/\L\1/') | ||
tag=":$ENV_SLUG" | ||
az extension add --name containerapp | ||
az containerapp job start -n portal-dbclone --resource-group rg-ecc-portal-uks-dev --subscription "Essex County Council (Portal)" --image "acreccuksdev.azurecr.io/dbclone" --env-vars "NEW_DB_SUFFIX=${ENV_SLUG}" 'MYSQL_HOST=mariadb-ecc-uks-dev.mariadb.database.azure.com' 'MYSQL_USER=mariadb-root' 'MYSQL_DATABASE=drupal_portal' 'MYSQL_PASSWORD=secretref:mysql-password' --container-name dbclonea --cpu 0.75 --memory 1.5 | ||
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" | ||
sleep 4m | ||
echo "Creating new revision of Container App" | ||
cat > revision.yml <<EOF | ||
properties: | ||
template: | ||
revisionSuffix: gh${GITHUB_RUN_ID} | ||
scale: | ||
minReplicas: 0 | ||
maxReplicas: 1 | ||
rules: | ||
- name: "http-rule" | ||
http: | ||
metadata: | ||
concurrentRequests: 40 | ||
containers: | ||
- image: acreccuksdev.azurecr.io/portal-nginx-drupal$tag | ||
name: nginx | ||
resources: | ||
cpu: 0.25 | ||
memory: 0.5Gi | ||
volumeMounts: | ||
- mountPath: /drupal/web/sites/default/files | ||
volumeName: filesharevol | ||
env: | ||
- name: X_ROBOTS_TAG | ||
value: noindex | ||
probes: | ||
- type: liveness | ||
httpGet: | ||
path: "/dd822309-ae33-4e29-addf-869b07453a06" | ||
port: 80 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 3 | ||
- image: acreccuksdev.azurecr.io/portal-drupal-fpm$tag | ||
name: drupal | ||
resources: | ||
cpu: 0.75 | ||
memory: 1.5Gi | ||
volumeMounts: | ||
- mountPath: /drupal/web/sites/default/files | ||
volumeName: filesharevol | ||
- mountPath: /drupal/data/default/private | ||
volumeName: privsharevol | ||
env: | ||
- name: MYSQL_HOST | ||
value: mariadb-ecc-uks-dev.mariadb.database.azure.com | ||
- name: MYSQL_USER | ||
value: mariadb-root | ||
- name: MYSQL_DATABASE | ||
value: drupal_ci_${ENV_SLUG} | ||
- name: MYSQL_PASSWORD | ||
secretRef: mysql-password | ||
- name: OPENID_CONNECT_PARAMS | ||
secretRef: openid-connect-params | ||
probes: | ||
- type: liveness | ||
tcpSocket: | ||
port: 9000 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 3 | ||
EOF | ||
az containerapp revision copy --name portal --resource-group rg-ecc-portal-uks-dev --yaml revision.yml --subscription "Essex County Council (Portal)" | tee revision.json | ||
az containerapp revision label add --no-prompt --resource-group rg-ecc-portal-uks-dev --name portal --label ${ENV_SLUG} --revision portal--gh${GITHUB_RUN_ID} --subscription "Essex County Council (Portal)" | ||
echo "env_slug=${ENV_SLUG}" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Find Comment | ||
uses: peter-evans/find-comment@v3 | ||
id: fc | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: Review application | ||
|
||
- name: Create or update comment | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
Review application | ||
https://portal---${{ steps.deploy.outputs.env_slug }}.livelyforest-609fad32.uksouth.azurecontainerapps.io/ | ||
edit-mode: replace |
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 @@ | ||
b |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To give enough time for GL to build and push?