source <(gsutil cat gs://cloud-training/gsp318/marking/setup_marking.sh)
gcloud source repos clone valkyrie-app
cd valkyrie-app
cat > Dockerfile <<EOF
FROM golang:1.10
WORKDIR /go/src/app
COPY source .
RUN go install -v
ENTRYPOINT ["app","-single=true","-port=8080"]
EOF
docker build -t valkyrie-app:v0.0.1 .
~/marking/step1.sh
docker run -p 8080:8080 valkyrie-app:v0.0.1 &
~/marking/step2.sh
docker tag valkyrie-app:v0.0.1 gcr.io/$DEVSHELL_PROJECT_ID/valkyrie-app:v0.0.1
docker push gcr.io/$DEVSHELL_PROJECT_ID/valkyrie-app:v0.0.1
gcloud container clusters get-credentials valkyrie-dev --region us-east1-d
Use a text editor to modify deployment.yaml and replace IMAGE_HERE with gcr.io/$DEVSHELL_PROJECT_ID/valkyrie-app:v0.0.1
sed -i s#IMAGE_HERE#gcr.io/$GOOGLE_CLOUD_PROJECT/valkyrie-app:v0.0.1#g k8s/deployment.yaml
kubectl create -f deployment.yaml
kubectl create -f service.yaml
kubectl scale -f deployment.yaml --replicas=3
git merge origin/kurt-dev
docker build -t valkyrie-app:v0.0.2 .
docker tag valkyrie-app:v0.0.2 gcr.io/$DEVSHELL_PROJECT_ID/valkyrie-app:v0.0.2
docker push gcr.io/$DEVSHELL_PROJECT_ID/valkyrie-app:v0.0.2
kubectl edit deployment valkyrie-dev //0.0.1 -> 0.0.2
printf $(kubectl get secret cd-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/component=jenkins-master" -l "app.kubernetes.io/instance=cd" -o jsonpath="{.items[0].metadata.name}")
docker rm -f `docker ps -qa`
kubectl port-forward $POD_NAME 8080:8080 >> /dev/null &
login Jenkins admin/PASSWORD Setup your credentials to use Google Service Account from metadata. Manage Credentials -> Jenkins -> Add Credentials -> Google Service Account from metadata Creating the Jenkins job 1 . Click Jenkins > New Item in the left navigation: 2. Name the project valkyrie-app, then choose the Multibranch Pipeline option and click OK. 3. On the next page, in the Branch Sources section, click Add Source and select git. 4. Paste the HTTPS clone URL of your sample-app repo in Cloud Source Repositories https://source.developers.google.com/p/YOUR_PROJECT_ID/r/valkyrie-app into the Project Repository field. Remember to replace YOUR_PROJECT_ID with your GCP Project ID. 5. From the Credentials drop-down, select the name of the credentials you created when adding your service account in the previous steps. 6. Under Scan Multibranch Pipeline Triggers section, check the Periodically if not otherwise run box and set the Interval value to 1 minute. 7. Open Jenkinsfile file in a text editor, and replace YOUR_PROJECT with your GCP project ID. 8. Open source/html.go file in a text editor, and change the color of headings from green to orange.
git config --global user.email $PROJECT
git config --global user.name $PROJECT
git add *
git commit -m 'green to orange'
git push origin master