-
Notifications
You must be signed in to change notification settings - Fork 0
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
d3a1222
commit 762be59
Showing
7 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,76 @@ | ||
name: GitWorks Workbench CI/CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
PROJECT_ID: ${{ secrets.GKE_PROJECT }} | ||
GAR_LOCATION: europe-west2 | ||
DEPLOYMENT_NAME: gke-gitworks-workbench | ||
REPOSITORY: gitworks-workbench | ||
IMAGE: gitworks-workbench | ||
|
||
jobs: | ||
setup-build-publish-deploy: | ||
name: Setup, Build, Publish, and Deploy | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- run: npm ci | ||
- run: npm run package | ||
|
||
- run: npm install -g @vscode/vsce | ||
- run: vsce package | ||
- name: Archive VSCode VSIX | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: vscode-vsix | ||
path: ./*.vsix | ||
|
||
- run: docker build -t $GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA . | ||
|
||
- id: 'auth' | ||
uses: 'google-github-actions/auth@v0' | ||
with: | ||
credentials_json: ${{ secrets.GKE_SA_KEY }} | ||
|
||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v0 | ||
|
||
- name: Docker configuration | ||
run: |- | ||
gcloud --quiet auth configure-docker $GAR_LOCATION-docker.pkg.dev | ||
- id: 'get-credentials' | ||
uses: 'google-github-actions/get-gke-credentials@v0' | ||
with: | ||
cluster_name: gitworks-workbench-autopilot-cluster | ||
location: europe-west2 | ||
|
||
- name: Publish | ||
run: |- | ||
docker push "$GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA" | ||
- name: Set up Kustomize | ||
run: |- | ||
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64 | ||
chmod u+x ./kustomize | ||
- name: Deploy | ||
run: |- | ||
./kustomize edit set image LOCATION-docker.pkg.dev/PROJECT_ID/REPOSITORY/IMAGE:TAG=$GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA | ||
./kustomize build . | kubectl apply -f - | ||
kubectl rollout status deployment/$DEPLOYMENT_NAME | ||
kubectl get services -o wide |
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,17 @@ | ||
FROM node:16 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
WORKDIR /usr/src/app/vscode-test-web | ||
|
||
RUN export NODE_ENV=development | ||
|
||
RUN yarn --frozen-lockfile | ||
RUN yarn --cwd=fs-provider --frozen-lockfile | ||
RUN yarn run compile | ||
|
||
EXPOSE 3000 | ||
|
||
CMD [ "node", ".", "--protocol=https", "--browser=none", "--host=0.0.0.0", "--quality=insiders", "--extensionDevelopmentPath=..", "--extensionId=vscode-icons-team.vscode-icons" ] |
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,39 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: gke-gitworks-workbench | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: gke-gitworks-workbench | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 1 | ||
maxUnavailable: 1 | ||
minReadySeconds: 5 | ||
template: | ||
metadata: | ||
labels: | ||
app: gke-gitworks-workbench | ||
spec: | ||
# volumes: | ||
# - name: gitworks-workbench-storage | ||
# emptyDir: null | ||
# persistentVolumeClaim: | ||
# claimName: gitworks-workbench-storage-claim | ||
containers: | ||
- name: gke-gitworks-workbench | ||
image: LOCATION-docker.pkg.dev/PROJECT_ID/REPOSITORY/IMAGE:TAG | ||
ports: | ||
- containerPort: 3000 | ||
resources: | ||
requests: | ||
cpu: 2 | ||
memory: 4Gi | ||
limits: | ||
cpu: 16 | ||
memory: 32Gi | ||
# volumeMounts: | ||
# - mountPath: /var/gitworks | ||
# name: gitworks-storage |
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: | ||
- deployment.yml | ||
- service.yml | ||
#- storage.yml |
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: gke-gitworks-workbench-service | ||
spec: | ||
type: LoadBalancer | ||
loadBalancerIP: "34.147.140.210" | ||
ports: | ||
- port: 80 | ||
targetPort: 3000 | ||
selector: | ||
app: gke-gitworks-workbench |
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: PersistentVolumeClaim | ||
metadata: | ||
name: gitworks-workbench-storage-claim | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: "standard" | ||
volumeName: gitworks-workbench-storage | ||
resources: | ||
requests: | ||
storage: 25Gi |