Last active
January 18, 2022 00:46
-
-
Save vfarcic/46d8171750213481c29008653d237036 to your computer and use it in GitHub Desktop.
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
# Links to gists for creating a cluster with jx | |
# gke-jx-serverless.sh: https://gist.github.com/fe18870a015f4acc34d91c106d0d43c8 | |
# eks-jx-serverless.sh: https://gist.github.com/f4a1df244d1852ee250e751c7191f5bd | |
# aks-jx-serverless.sh: https://gist.github.com/b07f45f6907c2a1c71f45dbe0df8d410 | |
# install-serverless.sh: https://gist.github.com/7b3b3d90ecd7f343effe4fff5241d037 | |
cd go-demo-6 | |
git pull | |
git checkout extension-model-cd | |
git merge -s ours master --no-edit | |
git checkout master | |
git merge extension-model-cd | |
git push | |
cd .. | |
cd go-demo-6 | |
jx import --pack go --batch-mode | |
cd .. | |
cd go-demo-6 | |
cat jenkins-x.yml | |
git checkout -b better-pipeline | |
echo "buildPack: go | |
pipelineConfig: | |
pipelines: | |
pullRequest: | |
build: | |
preSteps: | |
# This was modified | |
- name: unit-tests | |
command: make unittest | |
promote: | |
steps: | |
# This is new | |
- name: rollout | |
command: | | |
NS=\`echo cd-\$REPO_OWNER-go-demo-6-\$BRANCH_NAME | tr '[:upper:]' '[:lower:]'\` | |
sleep 15 | |
kubectl -n \$NS rollout status deployment preview-preview --timeout 3m | |
# This was modified | |
- name: functional-tests | |
command: ADDRESS=\`jx get preview --current 2>&1\` make functest | |
" | tee jenkins-x.yml | |
jx step syntax validate pipeline | |
git add . | |
git commit -m "rollout status" | |
git push --set-upstream origin \ | |
better-pipeline | |
jx create pullrequest \ | |
--title "Better pipeline" \ | |
--body "What I can say?" \ | |
--batch-mode | |
BRANCH=[...] # e.g., PR-72 | |
jx get activities \ | |
--filter go-demo-6/$BRANCH \ | |
--watch | |
jx get build logs --current | |
curl -o Makefile \ | |
https://gist.githubusercontent.com/vfarcic/313bedd36e863249cb01af1f459139c7/raw | |
open "https://codecov.io/" | |
CODECOV_TOKEN=[...] | |
open "https://github.com/vfarcic/codecov" | |
echo "buildPack: go | |
pipelineConfig: | |
# This is new | |
env: | |
- name: CODECOV_TOKEN | |
value: \"$CODECOV_TOKEN\" | |
pipelines: | |
pullRequest: | |
build: | |
preSteps: | |
- name: unit-tests | |
command: make unittest | |
# This is new | |
- name: code-coverage | |
command: codecov.sh | |
agent: | |
image: vfarcic/codecov | |
promote: | |
steps: | |
- name: rollout | |
command: | | |
NS=\`echo cd-\$REPO_OWNER-go-demo-6-\$BRANCH_NAME | tr '[:upper:]' '[:lower:]'\` | |
sleep 15 | |
kubectl -n \$NS rollout status deployment preview-preview --timeout 3m | |
- name: functional-tests | |
command: ADDRESS=\`jx get preview --current 2>&1\` make functest | |
" | tee jenkins-x.yml | |
jx step syntax validate pipeline | |
git add . | |
git commit -m "Code coverage" | |
git push | |
jx get activities \ | |
--filter go-demo-6/$BRANCH \ | |
--watch | |
jx get build logs --current | |
kubectl create secret \ | |
generic codecov \ | |
--from-literal=token=$CODECOV_TOKEN | |
echo "buildPack: go | |
pipelineConfig: | |
env: | |
# This was modified | |
- name: CODECOV_TOKEN | |
valueFrom: | |
secretKeyRef: | |
key: token | |
name: codecov | |
pipelines: | |
pullRequest: | |
build: | |
preSteps: | |
- name: unit-tests | |
command: make unittest | |
- name: code-coverage | |
command: codecov.sh | |
agent: | |
image: vfarcic/codecov | |
promote: | |
steps: | |
- name: rollout | |
command: | | |
NS=\`echo cd-\$REPO_OWNER-go-demo-6-\$BRANCH_NAME | tr '[:upper:]' '[:lower:]'\` | |
sleep 15 | |
kubectl -n \$NS rollout status deployment preview-preview --timeout 3m | |
- name: functional-tests | |
command: ADDRESS=\`jx get preview --current 2>&1\` make functest | |
" | tee jenkins-x.yml | |
jx step syntax validate pipeline | |
git add . | |
git commit -m "Code coverage secret" | |
git push | |
jx get activities \ | |
--filter go-demo-6/$BRANCH \ | |
--watch | |
git checkout master | |
git pull | |
git branch -d better-pipeline | |
echo "buildPack: go | |
pipelineConfig: | |
env: | |
- name: CODECOV_TOKEN | |
valueFrom: | |
secretKeyRef: | |
key: token | |
name: codecov | |
pipelines: | |
pullRequest: | |
build: | |
preSteps: | |
- name: unit-tests | |
command: make unittest | |
- name: code-coverage | |
command: codecov.sh | |
agent: | |
image: vfarcic/codecov | |
promote: | |
steps: | |
- name: rollout | |
command: | | |
NS=\`echo cd-\$REPO_OWNER-go-demo-6-\$BRANCH_NAME | tr '[:upper:]' '[:lower:]'\` | |
sleep 15 | |
kubectl -n \$NS rollout status deployment preview-preview --timeout 3m | |
- name: functional-tests | |
command: ADDRESS=\`jx get preview --current 2>&1\` make functest | |
# This is new | |
overrides: | |
- pipeline: release | |
" | tee jenkins-x.yml | |
jx step syntax validate pipeline | |
git add . | |
git commit -m "Multi-architecture" | |
git push | |
jx get activities \ | |
--filter go-demo-6/master \ | |
--watch | |
echo "buildPack: go | |
pipelineConfig: | |
env: | |
- name: CODECOV_TOKEN | |
valueFrom: | |
secretKeyRef: | |
key: token | |
name: codecov | |
pipelines: | |
pullRequest: | |
build: | |
preSteps: | |
- name: unit-tests | |
command: make unittest | |
- name: code-coverage | |
command: codecov.sh | |
agent: | |
image: vfarcic/codecov | |
promote: | |
steps: | |
- name: rollout | |
command: | | |
NS=\`echo cd-\$REPO_OWNER-go-demo-6-\$BRANCH_NAME | tr '[:upper:]' '[:lower:]'\` | |
sleep 15 | |
kubectl -n \$NS rollout status deployment preview-preview --timeout 3m | |
- name: functional-tests | |
command: ADDRESS=\`jx get preview --current 2>&1\` make functest | |
overrides: | |
- pipeline: release | |
# This is new | |
stage: build | |
# This is new | |
release: | |
promote: | |
steps: | |
- name: rollout | |
command: | | |
sleep 15 | |
kubectl -n cd-staging rollout status deployment jx-go-demo-6 --timeout 3m | |
" | tee jenkins-x.yml | |
jx step syntax validate pipeline | |
git add . | |
git commit -m "Multi-architecture" | |
git push | |
jx get activities \ | |
--filter go-demo-6/master \ | |
--watch | |
echo "buildPack: go | |
pipelineConfig: | |
env: | |
- name: CODECOV_TOKEN | |
valueFrom: | |
secretKeyRef: | |
key: token | |
name: codecov | |
pipelines: | |
pullRequest: | |
build: | |
preSteps: | |
- name: unit-tests | |
command: make unittest | |
- name: code-coverage | |
command: codecov.sh | |
agent: | |
image: vfarcic/codecov | |
promote: | |
steps: | |
- name: rollout | |
command: | | |
NS=\`echo cd-\$REPO_OWNER-go-demo-6-\$BRANCH_NAME | tr '[:upper:]' '[:lower:]'\` | |
sleep 15 | |
kubectl -n \$NS rollout status deployment preview-preview --timeout 3m | |
- name: functional-tests | |
command: ADDRESS=\`jx get preview --current 2>&1\` make functest | |
# Removed overrides | |
release: | |
promote: | |
steps: | |
- name: rollout | |
command: | | |
sleep 15 | |
kubectl -n cd-staging rollout status deployment jx-go-demo-6 --timeout 3m | |
" | tee jenkins-x.yml | |
jx step syntax effective | |
echo "buildPack: go | |
pipelineConfig: | |
env: | |
- name: CODECOV_TOKEN | |
valueFrom: | |
secretKeyRef: | |
key: token | |
name: codecov | |
pipelines: | |
pullRequest: | |
build: | |
preSteps: | |
- name: unit-tests | |
command: make unittest | |
- name: code-coverage | |
command: codecov.sh | |
agent: | |
image: vfarcic/codecov | |
promote: | |
steps: | |
- name: rollout | |
command: | | |
NS=\`echo cd-\$REPO_OWNER-go-demo-6-\$BRANCH_NAME | tr '[:upper:]' '[:lower:]'\` | |
sleep 15 | |
kubectl -n \$NS rollout status deployment preview-preview --timeout 3m | |
- name: functional-tests | |
command: ADDRESS=\`jx get preview --current 2>&1\` make functest | |
overrides: | |
- pipeline: release | |
# This is new | |
stage: build | |
name: make-build | |
steps: | |
- loop: | |
variable: GOOS | |
values: | |
- darwin | |
- linux | |
- windows | |
steps: | |
- name: build | |
command: CGO_ENABLED=0 GOOS=\${GOOS} GOARCH=amd64 go build -o bin/go-demo-6_\${GOOS} main.go | |
release: | |
promote: | |
steps: | |
- name: rollout | |
command: | | |
sleep 15 | |
kubectl -n cd-staging rollout status deployment jx-go-demo-6 --timeout 3m | |
" | tee jenkins-x.yml | |
jx step syntax validate pipeline | |
cat Dockerfile | |
cat Dockerfile \ | |
| sed -e \ | |
's@/bin/ /@/bin/go-demo-6_linux /go-demo-6@g' \ | |
| tee Dockerfile | |
git add . | |
git commit -m "Multi-architecture" | |
git push | |
jx get activities \ | |
--filter go-demo-6/master \ | |
--watch | |
echo "buildPack: none | |
pipelineConfig: | |
pipelines: | |
release: | |
pipeline: | |
agent: | |
image: go | |
stages: | |
- name: nothing | |
steps: | |
- name: silly | |
command: echo \"This is a silly pipeline\"" \ | |
| tee jenkins-x.yml | |
git add . | |
git commit -m "Without buildpack" | |
git push | |
jx get activities \ | |
--filter go-demo-6/master \ | |
--watch | |
jx step syntax schema | |
jx step syntax schema --buildpack | |
jx step syntax validate buildpacks | |
git checkout extension-model-cd | |
git merge -s ours master --no-edit | |
git checkout master | |
git merge extension-model-cd | |
git push | |
cd .. | |
GH_USER=[...] | |
hub delete -y \ | |
$GH_USER/environment-jx-rocks-staging | |
hub delete -y \ | |
$GH_USER/environment-jx-rocks-production | |
rm -rf ~/.jx/environments/$GH_USER/environment-jx-rocks-* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment