uffizzicloud / github-actions-example Goto Github PK
View Code? Open in Web Editor NEWCreate pull request environments from GitHub Actions
Create pull request environments from GitHub Actions
create-ucluster.yaml:
name: Uffizzi Cluster Quickstart
on:
pull_request:
types: [opened,reopened,synchronize,closed]
permissions:
id-token: write
jobs:
build-vote:
name: Build and Push `vote`
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout git repo
uses: actions/checkout@v3
- name: Generate UUID image name
id: uuid
run: echo "UUID_VOTE=$(uuidgen)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
# 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 Uffizzi Ephemeral Registry
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: ./vote
build-worker:
name: Build and Push `worker`
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout git repo
uses: actions/checkout@v3
- name: Generate UUID image name
id: uuid
run: echo "UUID_WORKER=$(uuidgen)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
# 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 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
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout git repo
uses: actions/checkout@v3
- name: Generate UUID image name
id: uuid
run: echo "UUID_RESULT=$(uuidgen)" >> $GITHUB_ENV
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
# 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 Uffizzi Ephemeral Registry
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: ./result
oof-take-it-easy:
name: testing ucluster creation via action
runs-on: ubuntu-latest
needs:
- build-vote
- build-worker
- build-result
steps:
- name: Checkout
uses: actions/checkout@v3
- name: cluster-create
id: cluster-create
uses: UffizziCloud/cluster-action@mostlydevops
with:
# username: [email protected]
# password: ${{ secrets.uffizzi_password }}
# project: default
cluster-name: pr-${{ github.event.repository.name }}-${{ github.event.number }}
- name: Kustomize and apply
run: |
# echo ${{ needs.build-vote.outputs.tags }}
# echo ${{ needs.build-worker.outputs.tags }}
# echo ${{ needs.build-result.outputs.tags }}
# echo $(pwd)
kustomize edit set image vote-image=${{ needs.build-vote.outputs.tags }}
kustomize edit set image result-image=${{ needs.build-result.outputs.tags }}
kustomize edit set image worker-image=${{ needs.build-worker.outputs.tags }}
cat kubeconfig
kustomize build . | kubectl apply --kubeconfig kubeconfig -f -
Error:
Unable to connect to the server: tls: failed to verify certificate: x509: certificate is valid for *.app.qa-gke.uffizzi.com, not pr-quickstart-k8s-19.uc.app.qa-gke.uffizzi.com
Error: Process completed with exit code 1.
Temporary fix (?) :
Modified - cluster-name: pr-${{ github.event.repository.name }}-${{ github.event.number }}
to cluster-name: pr-${{ github.event.number }}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.