Merge pull request #1 from rberrelleza/develop-on-okteto
Signed-off-by: Ramiro Berrelleza <rberrelleza@gmail.com>
This commit is contained in:
commit
175ce9ef4e
7 changed files with 88 additions and 88 deletions
102
.github/workflows/ci.yml
vendored
102
.github/workflows/ci.yml
vendored
|
@ -1,80 +1,34 @@
|
||||||
# Copyright 2020 Google LLC
|
# file: .github/workflows/preview.yaml
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
name: "Continuous Integration"
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
# run on pushes to master or release/*
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- release/*
|
|
||||||
pull_request:
|
pull_request:
|
||||||
# run on pull requests targeting master
|
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run-tests:
|
preview:
|
||||||
runs-on: self-hosted
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: checkout
|
||||||
- name: License Check
|
uses: actions/checkout@master
|
||||||
run: |
|
|
||||||
set -x
|
- name: Login
|
||||||
git init
|
uses: okteto/login@master
|
||||||
git add --all
|
with:
|
||||||
git -c user.name="CI Bot" -c user.email="<>" commit -m "initial state"
|
token: ${{ secrets.OKTETO_TOKEN }}
|
||||||
addlicense ./
|
|
||||||
test -z $(git diff --name-only | tee /dev/stderr)
|
- name: Create namespace
|
||||||
- name: Setup Cluster
|
uses: okteto/create-namespace@master
|
||||||
run: |
|
with:
|
||||||
set -x
|
namespace: pr-${{ github.event.number }}
|
||||||
kind delete cluster || true
|
|
||||||
kind create cluster
|
- name: Deploy Application
|
||||||
kubectl get nodes
|
uses: okteto/pipeline@master
|
||||||
- name: Deploy From Source
|
with:
|
||||||
run: |
|
name: pr-${{ github.event.number }}
|
||||||
skaffold config set --global local-cluster true
|
|
||||||
skaffold run --default-repo local
|
- name: comment PR
|
||||||
- name: Wait For Pods
|
uses: unsplash/comment-on-pr@master
|
||||||
timeout-minutes: 20
|
env:
|
||||||
run: |
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
set -x
|
with:
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/adservice
|
msg: "Preview environment available at https://frontend-pr-${{ github.event.number }}.sf.okteto.net"
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/cartservice
|
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/checkoutservice
|
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/currencyservice
|
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/emailservice
|
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/frontend
|
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/loadgenerator
|
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/paymentservice
|
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/productcatalogservice
|
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/recommendationservice
|
|
||||||
kubectl wait --for=condition=available --timeout=500s deployment/shippingservice
|
|
||||||
- name: Smoke Test
|
|
||||||
timeout-minutes: 5
|
|
||||||
run: |
|
|
||||||
set -x
|
|
||||||
# start fresh loadgenerator pod
|
|
||||||
kubectl delete pod -l app=loadgenerator
|
|
||||||
# wait for requests to come in
|
|
||||||
REQUEST_COUNT="0"
|
|
||||||
while [[ "$REQUEST_COUNT" -lt "50" ]]; do
|
|
||||||
sleep 5
|
|
||||||
REQUEST_COUNT=$(kubectl logs -l app=loadgenerator | grep Aggregated | awk '{print $2}')
|
|
||||||
done
|
|
||||||
# ensure there are no errors hitting endpoints
|
|
||||||
ERROR_COUNT=$(kubectl logs -l app=loadgenerator | grep Aggregated | awk '{print $3}' | sed "s/[(][^)]*[)]//g")
|
|
||||||
if [[ "$ERROR_COUNT" -gt "0" ]]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
|
@ -2,6 +2,11 @@
|
||||||
<img src="src/frontend/static/icons/Hipster_HeroLogoCyan.svg" width="300"/>
|
<img src="src/frontend/static/icons/Hipster_HeroLogoCyan.svg" width="300"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://okteto.sf.okteto.net/deploy">
|
||||||
|
<img src="https://okteto.com/develop-okteto.svg" alt="Develop on Okteto">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
**Online Boutique** is a cloud-native microservices demo application.
|
**Online Boutique** is a cloud-native microservices demo application.
|
||||||
|
|
8
kustomization.yaml
Normal file
8
kustomization.yaml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- release/kubernetes-manifests.yaml
|
||||||
|
images:
|
||||||
|
- name: frontend
|
||||||
|
newName: okteto.dev/frontend
|
||||||
|
newTag: foo
|
9
okteto-pipelines.yaml
Normal file
9
okteto-pipelines.yaml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
icon: https://raw.githubusercontent.com/rberrelleza/microservices-demo/master/src/frontend/static/icons/Hipster_HeroLogoCyan.svg
|
||||||
|
deploy:
|
||||||
|
- okteto build -t okteto.dev/frontend:${OKTETO_GIT_COMMIT} src/frontend
|
||||||
|
- kustomize edit set image frontend=okteto.dev/frontend:${OKTETO_GIT_COMMIT}
|
||||||
|
- kustomize build --output release/kubernetes-manifests.yaml
|
||||||
|
- kubectl apply -f release/kubernetes-manifests.yaml
|
||||||
|
- kubectl annotate service frontend dev.okteto.com/auto-ingress=true --overwrite
|
||||||
|
devs:
|
||||||
|
- src/frontend/okteto.yml
|
|
@ -215,7 +215,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: server
|
- name: server
|
||||||
image: gcr.io/google-samples/microservices-demo/frontend:v0.2.0
|
image: frontend
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
|
@ -280,19 +280,6 @@ spec:
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 8080
|
targetPort: 8080
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: frontend-external
|
|
||||||
spec:
|
|
||||||
type: LoadBalancer
|
|
||||||
selector:
|
|
||||||
app: frontend
|
|
||||||
ports:
|
|
||||||
- name: http
|
|
||||||
port: 80
|
|
||||||
targetPort: 8080
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
|
|
16
src/frontend/.stignore
Normal file
16
src/frontend/.stignore
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
.git
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, built with go test -c
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# dlv binary
|
||||||
|
__debug_bin
|
||||||
|
vendor
|
21
src/frontend/okteto.yml
Normal file
21
src/frontend/okteto.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
name: frontend
|
||||||
|
image: ramiro/frontend:okteto
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
workdir: /go/src/github.com/GoogleCloudPlatform/microservices-demo/src/frontend
|
||||||
|
forward:
|
||||||
|
- 2345:2345
|
||||||
|
- 8080:8080
|
||||||
|
volumes:
|
||||||
|
- /go/pkg/
|
||||||
|
- /root/.cache/go-build/
|
||||||
|
persistentVolume:
|
||||||
|
enabled: true
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: "1"
|
||||||
|
memory: 2Gi
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- SYS_PTRACE
|
Loading…
Add table
Reference in a new issue