Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
84e265f
Create build-images.yaml
gadkins Oct 6, 2022
559c23f
Added two-stage workflow for forks
gadkins Oct 6, 2022
25d491a
Merge pull request #12 from UffizziCloud/update-workflow
gadkins Oct 6, 2022
c0d68d8
Update build-images.yaml
gadkins Oct 7, 2022
a1d4145
Correct file path
gadkins Oct 7, 2022
0b8e9aa
Merge pull request #13 from UffizziCloud/update-workflow
gadkins Oct 7, 2022
66a456f
Update description for two-stage workflow
gadkins Oct 10, 2022
138390e
Merge pull request #16 from UffizziCloud/update-readme
gadkins Oct 10, 2022
b46f1b5
Fixed typo
gadkins Oct 10, 2022
8e6db6e
Merge pull request #17 from UffizziCloud/update-readme
gadkins Oct 10, 2022
9ce0730
Update README.md
gadkins Oct 10, 2022
9791f67
Merge pull request #19 from UffizziCloud/update-readme
gadkins Oct 10, 2022
d94b493
Consolidate workflow
gadkins Oct 13, 2022
6de856a
Delete build-images.yaml
gadkins Oct 13, 2022
6cbbb0f
Rename workflow
gadkins Oct 13, 2022
58b21fb
Update README.md
gadkins Oct 13, 2022
31b1369
Update README.md
gadkins Oct 13, 2022
b272785
Update registry domain
gadkins Oct 13, 2022
65cb869
fix reusable workflow version to tag.
axisofentropy Oct 18, 2022
a31e675
Use latest release of reusable workflow.
axisofentropy Oct 27, 2022
9b38261
Remove trailing whitespace from README.
axisofentropy Oct 27, 2022
13314f2
Upgrade actions and avoid using deprecated `set-output` command. (#29)
axisofentropy Nov 7, 2022
aadb91b
Update README.md
gadkins Nov 9, 2022
05c97fa
Merge pull request #43 from UffizziCloud/update-readme
gadkins Nov 9, 2022
68a3819
Update README.md
gadkins Nov 9, 2022
3558407
Update README.md
gadkins Nov 9, 2022
091538b
Update README.md
gadkins Nov 9, 2022
688efcf
Merge pull request #44 from UffizziCloud/update-readme
gadkins Nov 9, 2022
2a4f51c
Add example load balancer update.
axisofentropy Nov 11, 2022
4bc549c
Specify platform for GHA job.
axisofentropy Nov 11, 2022
33a0640
Use latest reusable workflow.
axisofentropy Nov 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 70 additions & 44 deletions .github/workflows/uffizzi-preview.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Build Images and Handle Uffizzi Previews.
name: Build Images and Deploy Preview Environment

on:
push:
branches:
- main
- master
- staging
- qa
pull_request:
types: [opened,reopened,synchronize,closed]

Expand All @@ -22,15 +16,16 @@ jobs:
uses: actions/checkout@v3
- name: Generate UUID image name
id: uuid
run: echo "::set-output name=uuid::$(uuidgen)"
run: echo "UUID_VOTE=$(uuidgen)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ttl.sh/${{ steps.uuid.outputs.uuid }}
# An anonymous, emphemeral registry built on ttl.sh
images: registry.uffizzi.com/${{ env.UUID_VOTE }}
tags: type=raw,value=24h
- name: Build and Push Image to ttl.sh ephemeral registry
uses: docker/build-push-action@v2
- name: Build and Push Image to Uffizzi Ephemeral Registry
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand All @@ -48,21 +43,22 @@ jobs:
uses: actions/checkout@v3
- name: Generate UUID image name
id: uuid
run: echo "::set-output name=uuid::$(uuidgen)"
run: echo "UUID_WORKER=$(uuidgen)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ttl.sh/${{ steps.uuid.outputs.uuid }}
# An anonymous, emphemeral registry built on ttl.sh
images: registry.uffizzi.com/${{ env.UUID_WORKER }}
tags: type=raw,value=24h
- name: Build and Push Image to ttl.sh Ephemeral Registry
uses: docker/build-push-action@v2
- name: Build and Push Image to Uffizzi Ephemeral Registry
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: ./worker

build-result:
name: Build and Push `result`
runs-on: ubuntu-latest
Expand All @@ -74,21 +70,22 @@ jobs:
uses: actions/checkout@v3
- name: Generate UUID image name
id: uuid
run: echo "::set-output name=uuid::$(uuidgen)"
run: echo "UUID_RESULT=$(uuidgen)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ttl.sh/${{ steps.uuid.outputs.uuid }}
# An anonymous, emphemeral registry built on ttl.sh
images: registry.uffizzi.com/${{ env.UUID_RESULT }}
tags: type=raw,value=24h
- name: Build and Push Image to ttl.sh Ephemeral Registry
uses: docker/build-push-action@v2
- name: Build and Push Image to Uffizzi Ephemeral Registry
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: ./result

build-loadbalancer:
name: Build and Push `loadbalancer`
runs-on: ubuntu-latest
Expand All @@ -100,32 +97,33 @@ jobs:
uses: actions/checkout@v3
- name: Generate UUID image name
id: uuid
run: echo "::set-output name=uuid::$(uuidgen)"
run: echo "UUID_LOADBALANCER=$(uuidgen)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ttl.sh/${{ steps.uuid.outputs.uuid }}
# An anonymous, emphemeral registry built on ttl.sh
images: registry.uffizzi.com/${{ env.UUID_LOADBALANCER }}
tags: type=raw,value=24h
- name: Build and Push Image to ttl.sh Ephemeral Registry
uses: docker/build-push-action@v2
- name: Build and Push Image to Uffizzi Ephemeral Registry
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: ./loadbalancer

render-compose-file:
name: Render Docker Compose File
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
needs:
needs:
- build-vote
- build-worker
- build-result
- build-loadbalancer
outputs:
compose-file-cache-key: ${{ steps.hash.outputs.hash }}
compose-file-cache-key: ${{ env.COMPOSE_FILE_HASH }}
compose-file-cache-path: docker-compose.rendered.yml
steps:
- name: Checkout git repo
uses: actions/checkout@v3
Expand All @@ -148,37 +146,65 @@ jobs:
cat docker-compose.rendered.yml
- name: Hash Rendered Compose File
id: hash
run: echo "::set-output name=hash::$(md5sum docker-compose.rendered.yml | awk '{ print $1 }')"
run: echo "COMPOSE_FILE_HASH=$(md5sum docker-compose.rendered.yml | awk '{ print $1 }')" >> $GITHUB_ENV
- name: Cache Rendered Compose File
uses: actions/cache@v3
with:
path: docker-compose.rendered.yml
key: ${{ steps.hash.outputs.hash }}
key: ${{ env.COMPOSE_FILE_HASH }}

deploy-uffizzi-preview:
name: Use Remote Workflow to Preview on Uffizzi
needs:
- render-compose-file
uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@v2
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
needs: render-compose-file
uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@v2.6.1
with:
compose-file-cache-key: ${{ needs.render-compose-file.outputs.compose-file-cache-key }}
compose-file-cache-path: docker-compose.rendered.yml
server: https://app.uffizzi.com/
compose-file-cache-path: ${{ needs.render-compose-file.outputs.compose-file-cache-path }}
server: https://app.uffizzi.com
permissions:
contents: read
pull-requests: write
id-token: write

delete-uffizzi-preview:
name: Use Remote Workflow to Delete an Existing Preview
uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@v2
uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@v2.6.1
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }}
with:
compose-file-cache-key: ''
compose-file-cache-path: docker-compose.rendered.yml
server: https://app.uffizzi.com/
server: https://app.uffizzi.com
permissions:
contents: read
pull-requests: write
id-token: write

update-persistent-url:
name: Update Persistent URL
runs-on: ubuntu-latest
needs: deploy-uffizzi-preview
steps:
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'

- name: 'Use gcloud CLI'
run: 'gcloud info'

- name: 'Render URL map definition'
run: |
cat <<EOF > url-map.yaml
defaultUrlRedirect:
hostRedirect: $(basename ${{ needs.deploy-uffizzi-preview.outputs.url }})
httpsRedirect: true
redirectResponseCode: MOVED_PERMANENTLY_DEFAULT
stripQuery: false
kind: compute#urlMap
name: deleteme-2022-11

- name: 'Update GCP Load Balancer'
run: 'gcloud compute url-maps import deleteme-2022-11 --source url-map.yaml --project uffizzi-pro-qa-gke'
Loading