Skip to content

Commit afd8a68

Browse files
feat: Add embedded UI with app installer wizard (#371)
* Initial wails setup * Update makefile * Test goreleaser build workflow * Update action * Update action * Update action * Update action * Update action * Update action * Update action * Update action * Update action * Update action * Update action * Drop the embedded UI from linux/arm64 and Docker images * Simplify goreleaser builds * Update GitHub CD action * Manually dispatch CD workflow for now * Remove unused files * Add basic client proxy to the UI * Add generic client for the backend API access * Multiple changes to make the installer work * Simplify root path * Handle wizard install logic * Reorder install logic * Update next steps and expose copy to clipboard logic * Update bindings and change ui command to install * Make build-cli-ui run build-web target * Remove unused button * Linting * Update github action * Fix wails dev config * Install app recipe in the API * Update make targets, next steps view and bump design system * Bump DS and update imports * Fix some todos * Update UI command usage description * Update GH action and some comments * Update bindings * Center text * Update makefile * Run gen mock client * Update context unit test * Update create cluster action * Update create cluster action * Update create cluster action * Update create cluster action * Set up CGO_LDFLAGS conditionally when building on darwin * Simplify build.mk --------- Co-authored-by: michaeljguarino <mguarino46@gmail.com>
1 parent 6d943fb commit afd8a68

170 files changed

Lines changed: 31553 additions & 421 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
sudo apt-get update
2020
sudo apt-get install -y terraform
2121
- run: |
22-
make install
22+
GOBIN="$HOME"/bin make install
2323
cp "$HOME"/bin/plural /usr/local/bin/
2424
chmod 755 /usr/local/bin/plural
2525
- run: hack/e2e/setup-plural.sh
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
name: CD / CLI
2+
on:
3+
push:
4+
tags:
5+
- 'v*.*.*'
6+
7+
jobs:
8+
# Build binaries with GoReleaser
9+
prepare:
10+
strategy:
11+
matrix:
12+
os: [ ubuntu-latest, macos-latest, windows-latest ]
13+
include:
14+
- os: ubuntu-latest
15+
goos: linux
16+
- os: macos-latest
17+
goos: darwin
18+
- os: windows-latest
19+
goos: windows
20+
runs-on: ${{ matrix.os }}
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
- name: Setup Go
27+
uses: actions/setup-go@v3
28+
with:
29+
go-version: 1.19
30+
cache: true
31+
- name: Setup Node
32+
uses: actions/setup-node@v3
33+
with:
34+
node-version: 16.18.1
35+
- name: Setup SHA variable
36+
shell: bash
37+
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
38+
- name: Setup Cache
39+
uses: actions/cache@v3.2.3
40+
with:
41+
path: dist/${{ matrix.goos }}
42+
key: ${{ matrix.goos }}-${{ env.sha_short }}
43+
enableCrossOsArchive: true
44+
- name: Install Dependencies
45+
if: matrix.goos == 'linux'
46+
shell: bash
47+
run: sudo apt install -y libwebkit2gtk-4.0-dev libgtk-3-dev
48+
- name: Build web
49+
shell: bash
50+
run: make build-web
51+
- name: GoReleaser (Build)
52+
uses: goreleaser/goreleaser-action@v4
53+
with:
54+
distribution: goreleaser-pro
55+
version: latest
56+
args: release --clean --split
57+
env:
58+
CGO_LDFLAGS: "${{ matrix.goos == 'darwin' && '-framework UniformTypeIdentifiers' || '' }}"
59+
GOOS: ${{ matrix.GOOS }}
60+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
61+
62+
# Release binaries with GoReleaser
63+
release:
64+
runs-on: ubuntu-latest
65+
needs: prepare
66+
env:
67+
DOCKER_CLI_EXPERIMENTAL: "enabled"
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v3
71+
with:
72+
fetch-depth: 0
73+
- uses: actions/setup-go@v3
74+
with:
75+
go-version: 1.19
76+
cache: true
77+
- name: Copy Cache From Previous Job
78+
shell: bash
79+
run: |
80+
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
81+
- name: Restore Linux Cache
82+
uses: actions/cache@v3.2.3
83+
with:
84+
path: dist/linux
85+
key: linux-${{ env.sha_short }}
86+
- name: Restore Darwin Cache
87+
uses: actions/cache@v3.2.3
88+
with:
89+
path: dist/darwin
90+
key: darwin-${{ env.sha_short }}
91+
- name: Restore Windows Cache
92+
uses: actions/cache@v3.2.3
93+
with:
94+
path: dist/windows
95+
key: windows-${{ env.sha_short }}
96+
enableCrossOsArchive: true
97+
- name: GoReleaser (Release)
98+
uses: goreleaser/goreleaser-action@v4
99+
if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit
100+
with:
101+
distribution: goreleaser-pro
102+
version: latest
103+
args: continue --merge
104+
env:
105+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
GITLAB_CLIENT_SECRET: ${{ secrets.GITLAB_CLIENT_SECRET }}
108+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
109+
110+
# Publish CLI / Cloud CLI container images
111+
publish:
112+
strategy:
113+
matrix:
114+
image: [ plural-cli, plural-cli-cloud ]
115+
include:
116+
- image: plural-cli
117+
dockerfile: ./Dockerfile
118+
- image: plural-cli-cloud
119+
dockerfile: ./dockerfiles/Dockerfile.cloud
120+
runs-on: ubuntu-latest
121+
needs: release
122+
permissions:
123+
contents: 'read'
124+
id-token: 'write'
125+
packages: 'write'
126+
security-events: write
127+
actions: read
128+
steps:
129+
- name: Checkout
130+
uses: actions/checkout@v3
131+
- name: Configure AWS Credentials
132+
uses: aws-actions/configure-aws-credentials@v1
133+
with:
134+
aws-region: us-east-2
135+
role-to-assume: arn:aws:iam::312272277431:role/github-actions/buildx-deployments
136+
role-session-name: PluralCLI
137+
- name: Setup kubectl
138+
uses: azure/setup-kubectl@v3
139+
- name: Get EKS credentials
140+
run: aws eks update-kubeconfig --name pluraldev
141+
- name: Docker meta
142+
id: meta
143+
uses: docker/metadata-action@v4
144+
with:
145+
# list of Docker images to use as base name for tags
146+
images: |
147+
ghcr.io/pluralsh/${{ matrix.image }}
148+
gcr.io/pluralsh/${{ matrix.image }}
149+
# generate Docker tags based on the following events/attributes
150+
tags: |
151+
type=semver,pattern={{version}}
152+
- name: Set up Docker Buildx
153+
id: builder
154+
uses: docker/setup-buildx-action@v2
155+
with:
156+
driver: kubernetes
157+
platforms: linux/amd64
158+
driver-opts: |
159+
namespace=buildx
160+
requests.cpu=1.5
161+
requests.memory=3.5Gi
162+
"nodeselector=plural.sh/scalingGroup=buildx-spot-x86"
163+
"tolerations=key=plural.sh/capacityType,value=SPOT,effect=NoSchedule;key=plural.sh/reserved,value=BUILDX,effect=NoSchedule"
164+
- name: Append ARM buildx builder from AWS
165+
run: |
166+
docker buildx create \
167+
--append \
168+
--bootstrap \
169+
--name ${{ steps.builder.outputs.name }} \
170+
--driver=kubernetes \
171+
--platform linux/arm64 \
172+
--node=${{ steps.builder.outputs.name }}-arm64 \
173+
--buildkitd-flags "--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host" \
174+
--driver-opt namespace=buildx \
175+
--driver-opt requests.cpu=1.5 \
176+
--driver-opt requests.memory=3.5Gi \
177+
'--driver-opt="nodeselector=plural.sh/scalingGroup=buildx-spot-arm64"' \
178+
'--driver-opt="tolerations=key=plural.sh/capacityType,value=SPOT,effect=NoSchedule;key=plural.sh/reserved,value=BUILDX,effect=NoSchedule"'
179+
- uses: google-github-actions/auth@v1
180+
with:
181+
workload_identity_provider: 'projects/${{ secrets.GOOGLE_PROJECT_ID }}/locations/global/workloadIdentityPools/github/providers/github'
182+
service_account: 'terraform@pluralsh.iam.gserviceaccount.com'
183+
token_format: 'access_token'
184+
create_credentials_file: true
185+
- uses: google-github-actions/setup-gcloud@v1.0.1
186+
- name: Login to gcr
187+
run: gcloud auth configure-docker -q
188+
- name: Login to plural registry
189+
uses: docker/login-action@v2
190+
with:
191+
registry: dkr.plural.sh
192+
username: mjg@plural.sh
193+
password: ${{ secrets.PLURAL_ACCESS_TOKEN }}
194+
- name: Login to GHCR
195+
uses: docker/login-action@v2
196+
with:
197+
registry: ghcr.io
198+
username: ${{ github.repository_owner }}
199+
password: ${{ secrets.GITHUB_TOKEN }}
200+
- name: Get current date
201+
id: date
202+
run: echo "date=$(date -u +'%Y-%m-%dT%H:%M:%S%z')" >> $GITHUB_OUTPUT
203+
- name: Build and push
204+
uses: docker/build-push-action@v4
205+
with:
206+
context: "."
207+
file: "${{ matrix.dockerfile }}"
208+
push: true
209+
tags: ${{ steps.meta.outputs.tags }}
210+
labels: ${{ steps.meta.outputs.labels }}
211+
platforms: linux/amd64,linux/arm64
212+
build-args: |
213+
APP_VSN=${{ github.ref_name }}
214+
APP_COMMIT=${{ github.sha }}
215+
APP_DATE=${{ steps.date.outputs.date }}
216+
- name: Run Trivy vulnerability scanner on image
217+
uses: aquasecurity/trivy-action@master
218+
with:
219+
scan-type: 'image'
220+
image-ref: ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
221+
hide-progress: false
222+
format: 'sarif'
223+
output: 'trivy-results.sarif'
224+
scanners: 'vuln'
225+
timeout: 10m
226+
ignore-unfixed: true
227+
- name: Upload Trivy scan results to GitHub Security tab
228+
uses: github/codeql-action/upload-sarif@v2
229+
with:
230+
sarif_file: 'trivy-results.sarif'

0 commit comments

Comments
 (0)