Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #6

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
88a4de1
create build steps for staging
avikalbajpai Jun 11, 2021
3271144
updated
avikalbajpai Jun 11, 2021
cb3dadd
Update build-staging.yml
avikalbajpai Jun 11, 2021
9e207c5
Update build-staging.yml
avikalbajpai Jun 11, 2021
be53e70
Update build-staging.yml
avikalbajpai Jun 11, 2021
f58c1be
Update build-staging.yml
avikalbajpai Jun 11, 2021
e11275a
Update build-staging.yml
avikalbajpai Jun 11, 2021
d8c938c
Update build-staging.yml
avikalbajpai Jun 11, 2021
d768baa
Update build-staging.yml
avikalbajpai Jun 11, 2021
038fee8
Update build-staging.yml
avikalbajpai Jun 11, 2021
47c6ec0
production pipeline
avikalbajpai Jun 15, 2021
807c847
test
avikalbajpai Jun 15, 2021
4837f9d
test
avikalbajpai Jun 15, 2021
33ea8ba
fix
avikalbajpai Jun 15, 2021
04943b6
Update build-production.yml
avikalbajpai Jun 15, 2021
d9b4b1e
Update build-production.yml
avikalbajpai Jun 15, 2021
5203d67
Update build-production.yml
avikalbajpai Jun 15, 2021
af83fbb
Update build-production.yml
avikalbajpai Jun 15, 2021
b0eedc3
Update build-production.yml
avikalbajpai Jun 15, 2021
dd0510f
Update build-production.yml
avikalbajpai Jun 15, 2021
4bcbe78
Update build-production.yml
avikalbajpai Jun 15, 2021
e2d8916
Update build-production.yml
avikalbajpai Jun 15, 2021
b976416
Update build-production.yml
avikalbajpai Jun 15, 2021
0a3c5e8
Update build-production.yml
avikalbajpai Jun 15, 2021
970edc6
Update build-production.yml
avikalbajpai Jun 15, 2021
da5bcd4
Update build-production.yml
avikalbajpai Jun 15, 2021
c2d9a90
Update build-production.yml
avikalbajpai Jun 15, 2021
2c48372
Update build-production.yml
avikalbajpai Jun 15, 2021
24c5932
Update build-production.yml
avikalbajpai Jun 15, 2021
d67981d
Update build-production.yml
avikalbajpai Jun 15, 2021
9f87541
Update build-production.yml
avikalbajpai Jun 15, 2021
7ecaab9
Update build-production.yml
avikalbajpai Jun 15, 2021
f485790
Update build-production.yml
avikalbajpai Jun 15, 2021
9d1fdf6
Update build-production.yml
avikalbajpai Jun 15, 2021
81b586c
Update build-production.yml
avikalbajpai Jun 15, 2021
c2afd1d
added helm
Jun 16, 2021
c3ba922
Create build steps for staging
avikalbajpai Jun 16, 2021
de31934
Creating first production deployment
avikalbajpai Jun 16, 2021
52f578f
Update build-production.yml
avikalbajpai Jun 16, 2021
4268b27
Update build-production.yml
avikalbajpai Jun 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/build-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build and push the tagged build to production

on:
push:
tags:
- 'v*'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build_push_image:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Docker Setup Buildx
# You may pin to the exact commit or the version.
# uses: docker/setup-buildx-action@0d135e0c2fc0dba0729c1a47ecfcf5a3c7f8579e
uses: docker/[email protected]
# Runs a single command using the runners shell
- name: Docker Login
# You may pin to the exact commit or the version.
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
uses: docker/[email protected]
with:
registry: ${{ secrets.ACR_NAME }}
username: ${{ secrets.ACR_LOGIN }}
password: ${{ secrets.ACR_PASSWORD }}

- name: Create Tag
id: gen_tags
run: |
echo '::set-output name=tags::'"${GITHUB_REF/refs\/tags\//}"
- name: Build and push Docker images
# You may pin to the exact commit or the version.
# uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
uses: docker/[email protected]
with:
context: .
tags: ${{ secrets.ACR_NAME }}/contoso-website:${{ steps.gen_tags.outputs.tags }}
push: true

deploy:
runs-on: ubuntu-latest
needs: build_push_image
steps:
- uses: actions/[email protected]

- name: Install Helm
uses: Azure/setup-helm@v1
with:
version: v3.3.1

- name: Azure Kubernetes set context
uses: Azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
resource-group: mslearn-gh-pipelines-22922
cluster-name: contoso-video

# ... File omitted
- name: Run Helm Deploy
run: |
helm upgrade \
--install \
--create-namespace \
--atomic \
--wait \
--namespace production \
contoso-website \
./kubernetes/contoso-website \
--set image.repository=${{ secrets.ACR_NAME }} \
--set dns.name=${{ secrets.DNS_NAME }} \
--set image.tag=${GITHUB_REF##*/}


63 changes: 63 additions & 0 deletions .github/workflows/build-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and push the latest build to staging

on:
push:
branches: [ main ]

jobs:
build_push_image:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Buildx
uses: docker/setup-buildx-action@v1

- name: Docker Login
uses: docker/[email protected]
with:
registry: ${{ secrets.ACR_NAME }}
username: ${{ secrets.ACR_LOGIN }}
password: ${{ secrets.ACR_PASSWORD }}

- name: Build and push staging images
uses: docker/[email protected]
with:
context: .
tags: ${{ secrets.ACR_NAME }}/contoso-website:latest
push: true

deploy:
runs-on: ubuntu-latest
needs: build_push_image
steps:
- uses: actions/[email protected]

- name: Install Helm
uses: Azure/setup-helm@v1
with:
version: v3.3.1

- name: Azure Kubernetes set context
uses: Azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
resource-group: mslearn-gh-pipelines-22922
cluster-name: contoso-video

# ... File omitted
- name: Run Helm Deploy
run: |
helm upgrade \
--install \
--create-namespace \
--atomic \
--wait \
--namespace staging \
contoso-website \
./kubernetes/contoso-website \
--set image.repository=${{ secrets.ACR_NAME }} \
--set dns.name=${{ secrets.DNS_NAME }}


23 changes: 23 additions & 0 deletions kubernetes/contoso-website/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
4 changes: 4 additions & 0 deletions kubernetes/contoso-website/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v2
name: contoso-website
description: Chart for the Contoso company website
version: 0.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: contoso-website
namespace: {{ default "staging" .Release.Namespace }}
spec:
selector:
matchLabels:
Expand All @@ -12,7 +13,7 @@ spec:
app: contoso-website
spec:
containers:
- image: !IMAGE!
- image: {{ .Values.image.registry }}/{{ .Values.image.name }}:{{ default "latest" .Values.image.tag }}
name: contoso-website
resources:
requests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: contoso-website
namespace: {{ default "staging" .Release.Namespace }}
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: contoso.!DNS!
- host: contoso-{{ default "staging" .Release.Namespace }}.{{ .Values.dns.name }}
http:
paths:
- backend:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: contoso-website
namespace: {{ default "staging" .Release.Namespace }}
spec:
ports:
- port: 80
Expand Down
7 changes: 7 additions & 0 deletions kubernetes/contoso-website/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
image:
registry: contosocontainerregistry32723.azurecr.io
name: contoso-website
tag: latest

dns:
name: ebcabb15a8b447c2b70f.eastus.aksapp.io
1 change: 1 addition & 0 deletions test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
testr
1 change: 1 addition & 0 deletions test file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test