-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e9277d
commit 244a4f6
Showing
9 changed files
with
305 additions
and
52 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"categories": [ | ||
{ | ||
"title": "## � Features", | ||
"labels": ["feature"] | ||
}, | ||
{ | ||
"title": "## � Fixes", | ||
"labels": ["fix"] | ||
}, | ||
{ | ||
"title": "## � Tests", | ||
"labels": ["test"] | ||
}, | ||
{ | ||
"title": "## � Other", | ||
"labels": ["other"] | ||
}, | ||
{ | ||
"title": "## � Dependencies", | ||
"labels": ["dependencies"] | ||
} | ||
], | ||
"sort": "ASC", | ||
"template": "${{CHANGELOG}}", | ||
"pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}", | ||
"empty_template": "- no changes", | ||
"max_pull_requests": 1000, | ||
"max_back_track_time_days": 1000 | ||
} |
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,163 @@ | ||
name: E2E | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
types: [opened,reopened,synchronize,closed] | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
id-token: write | ||
|
||
jobs: | ||
build-image: | ||
name: Build and Push `nodejs` Image | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }} | ||
outputs: | ||
tags: ${{ steps.meta.outputs.tags }} | ||
uuid: ${{ env.UUID_IMAGE }} | ||
steps: | ||
- name: Checkout git repo | ||
uses: actions/checkout@v3 | ||
- name: Generate UUID image name | ||
id: uuid | ||
run: echo "UUID_IMAGE=$(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_IMAGE }} | ||
tags: type=raw,value=48h | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-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: ./ | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
uffizzi-cluster: | ||
name: Deploy Helm chart to Uffizzi Virtual Cluster | ||
needs: | ||
- build-image | ||
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
# Identify comment to be updated | ||
- name: Find comment for Ephemeral Environment | ||
uses: peter-evans/find-comment@v2 | ||
id: find-comment | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: "github-actions[bot]" | ||
body-includes: pr-${{ github.event.pull_request.number }}-e2e-helm | ||
direction: last | ||
|
||
# Create/Update comment with action deployment status | ||
- name: Create or Update Comment with Deployment Notification | ||
id: notification | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
## Uffizzi Ephemeral Environment - Virtual Cluster - E2E Helm Chart | ||
:cloud: deploying ... | ||
:gear: Updating now by workflow run [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). | ||
Cluster name will be `pr-${{ github.event.pull_request.number }}-e2e-helm` | ||
Download the Uffizzi CLI to interact with the upcoming virtual cluster | ||
https://docs.uffizzi.com/install | ||
edit-mode: replace | ||
|
||
- name: Create and connect to vcluster | ||
uses: UffizziCloud/cluster-action@main | ||
with: | ||
cluster-name: pr-${{ github.event.pull_request.number }}-e2e-helm | ||
server: https://app.uffizzi.com | ||
|
||
- name: Apply Kustomize to test the new image | ||
id: prev | ||
run: | | ||
# Change the image name to those just built and pushed. | ||
kustomize edit set image uffizzi/hello-world-k8s=${{ needs.build-image.outputs.tags }} | ||
if [[ ${RUNNER_DEBUG} == 1 ]]; then | ||
cat kustomization.yaml | ||
echo "`pwd`" | ||
echo "`ls`" | ||
fi | ||
# Apply kustomized manifests to virtual cluster. | ||
kubectl apply --kustomize . --kubeconfig ./kubeconfig | ||
# Allow uffizzi to sync the resources | ||
sleep 5 | ||
# Get the hostnames assigned by uffizzi | ||
export VOTE_HOST=$(kubectl get ingress vote --kubeconfig kubeconfig -o json | jq '.spec.rules[0].host' | tr -d '"') | ||
export RESULT_HOST=$(kubectl get ingress result --kubeconfig kubeconfig -o json | jq '.spec.rules[0].host' | tr -d '"') | ||
if [[ ${RUNNER_DEBUG} == 1 ]]; then | ||
kubectl get all --kubeconfig ./kubeconfig | ||
fi | ||
echo "vote_url=${VOTE_HOST}" >> $GITHUB_OUTPUT | ||
echo "result_url=${RESULT_HOST}" >> $GITHUB_OUTPUT | ||
echo "Access the \`vote\` endpoint at [\`${VOTE_HOST}\`](http://${VOTE_HOST})" >> $GITHUB_STEP_SUMMARY | ||
echo "Access the \`result\` endpoint at [\`${RESULT_HOST}\`](http://${RESULT_HOST})" >> $GITHUB_STEP_SUMMARY | ||
- name: Create or Update Comment with Deployment URL | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
comment-id: ${{ steps.notification.outputs.comment-id }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
## Uffizzi Ephemeral Environment - Virtual Cluster - E2E Helm Chart | ||
E2E tests in progress on the `pr-${{ github.event.pull_request.number }}-e2e-helm` cluster. | ||
edit-mode: replace | ||
|
||
uffizzi-cluster-delete: | ||
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Delete Virtual Cluster | ||
uses: UffizziCloud/cluster-action@main | ||
with: | ||
action: delete | ||
cluster-name: pr-${{ github.event.pull_request.number }}-e2e-helm | ||
server: https://app.uffizzi.com | ||
|
||
# Identify comment to be updated | ||
- name: Find comment for Ephemeral Environment | ||
uses: peter-evans/find-comment@v2 | ||
id: find-comment | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: "github-actions[bot]" | ||
body-includes: pr-${{ github.event.pull_request.number }}-e2e-helm | ||
direction: last | ||
|
||
- name: Update Comment with Deletion | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
Uffizzi Cluster `pr-${{ github.event.pull_request.number }}` was deleted. | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Release Helm Charts | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions | ||
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Run chart-releaser | ||
uses: helm/[email protected] | ||
with: | ||
charts_dir: . | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
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,23 @@ | ||
name: Unit Tests and Coverage | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test_and_coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go 1.19 | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ^1.19 | ||
- name: Lint Helm Chart | ||
run: | | ||
(cd ./chart && helm dep update .) | ||
helm lint ./chart --with-subcharts | ||
- name: Test | ||
run: go test -coverprofile=coverage.txt -covermode=atomic -v ./... | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 |
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,19 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: web | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: web | ||
template: | ||
metadata: | ||
labels: | ||
app: web | ||
spec: | ||
containers: | ||
- name: web | ||
image: uffizzi/hello-world-k8s | ||
ports: | ||
- containerPort: 3000 |
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,21 @@ | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: web | ||
spec: | ||
ingressClassName: uffizzi | ||
rules: | ||
- host: web.example.com | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: web | ||
port: | ||
number: 3000 | ||
path: / | ||
pathType: Prefix | ||
tls: | ||
- hosts: | ||
- web.example.com |
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,12 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: web | ||
spec: | ||
ports: | ||
- port: 3000 | ||
name: http | ||
type: ClusterIP | ||
selector: | ||
app: web |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- k8s/deployment.yaml | ||
- k8s/ingress.yaml | ||
- k8s/service.yaml |