Skip to content

Commit

Permalink
Automated release process and updated docke repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
winromulus committed Nov 11, 2019
1 parent d37cd90 commit bebba9c
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 124 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Reflector
Reflector is a Kubernetes addon designed to monitor changes to resources (secrets and configmaps) and reflect changes to mirror resources in the same or other namespaces.

[![Build Status](https://dev.azure.com/emberstack/OpenSource/_apis/build/status/ES.Kubernetes.Reflector?branchName=master)](https://dev.azure.com/emberstack/OpenSource/_build/latest?definitionId=12&branchName=master)
[![Release](https://img.shields.io/github/release/emberstack/ES.Kubernetes.Reflector.svg?style=flat-square)](https://github.com/emberstack/ES.Kubernetes.Reflector/releases/latest)
[![GitHub Tag](https://img.shields.io/github/tag/emberstack/ES.Kubernetes.Reflector.svg?style=flat-square)](https://github.com/emberstack/ES.Kubernetes.Reflector/releases/latest)
[![Docker Image](https://images.microbadger.com/badges/image/emberstack/es.kubernetes.reflector.svg)](https://microbadger.com/images/emberstack/es.kubernetes.reflector)
[![Docker Version](https://images.microbadger.com/badges/version/emberstack/es.kubernetes.reflector.svg)](https://microbadger.com/images/emberstack/es.kubernetes.reflector)
[![Docker Pulls](https://img.shields.io/docker/pulls/emberstack/es.kubernetes.reflector.svg?style=flat-square)](https://hub.docker.com/r/emberstack/es.kubernetes.reflector)
[![Docker Stars](https://img.shields.io/docker/stars/emberstack/es.kubernetes.reflector.svg?style=flat-square)](https://hub.docker.com/r/remberstack/es.kubernetes.reflector)
[![license](https://img.shields.io/github/license/emberstack/ES.Kubernetes.Reflector.svg?style=flat-square)](LICENSE)
[![Build Status](https://dev.azure.com/emberstack/OpenSource/_apis/build/status/kubernetes-reflector?branchName=master)](https://dev.azure.com/emberstack/OpenSource/_build/latest?definitionId=12&branchName=master)
[![Release](https://img.shields.io/github/release/emberstack/kubernetes-reflector.svg?style=flat-square)](https://github.com/emberstack/kubernetes-reflector/releases/latest)
[![GitHub Tag](https://img.shields.io/github/tag/emberstack/kubernetes-reflector.svg?style=flat-square)](https://github.com/emberstack/kubernetes-reflector/releases/latest)
[![Docker Image](https://images.microbadger.com/badges/image/emberstack/kubernetes-reflector.svg)](https://microbadger.com/images/emberstack/kubernetes-reflector)
[![Docker Version](https://images.microbadger.com/badges/version/emberstack/kubernetes-reflector.svg)](https://microbadger.com/images/emberstack/kubernetes-reflector)
[![Docker Pulls](https://img.shields.io/docker/pulls/emberstack/kubernetes-reflector.svg?style=flat-square)](https://hub.docker.com/r/emberstack/kubernetes-reflector)
[![Docker Stars](https://img.shields.io/docker/stars/emberstack/kubernetes-reflector.svg?style=flat-square)](https://hub.docker.com/r/remberstack/kubernetes-reflector)
[![license](https://img.shields.io/github/license/emberstack/kubernetes-reflector.svg?style=flat-square)](LICENSE)


> Supports `amd64`, `arm` and `arm64`
Expand All @@ -35,7 +35,7 @@ You can customize the values of the helm deployment by using the following Value
| ------------------------------------ | ------------------------------------------------ | ------------------------------------------------------- |
| `nameOverride` | Overrides release name | `""` |
| `fullnameOverride` | Overrides release fullname | `""` |
| `image.repository` | Container image repository | `emberstack/es.kubernetes.reflector` |
| `image.repository` | Container image repository | `emberstack/kubernetes-reflector` |
| `image.tag` | Container image tag | `latest` |
| `image.pullPolicy` | Container image pull policy | `Always` if `image.tag` is `latest`, else `IfNotPresent`|
| `extensions.certManager.enabled` | `cert-manager` addon | `true` |
Expand All @@ -56,10 +56,10 @@ You can customize the values of the helm deployment by using the following Value

#### Manual deployment
Each release (found on the [Releases](https://github.com/EmberStack/ES.Kubernetes.Reflector/releases) GitHub page) contains the manual deployment file (`reflector.yaml`).
Each release (found on the [Releases](https://github.com/EmberStack/kubernetes-reflector/releases) GitHub page) contains the manual deployment file (`reflector.yaml`).

```shellsession
$ kubectl apply -f https://github.com/EmberStack/ES.Kubernetes.Reflector/releases/latest/download/reflector.yaml
$ kubectl apply -f https://github.com/EmberStack/kubernetes-reflector/releases/latest/download/reflector.yaml
```


Expand Down
289 changes: 181 additions & 108 deletions azure-pipelines.yaml
Original file line number Diff line number Diff line change
@@ -1,117 +1,190 @@
name: $(coreVersion).$(Date:yy)$(DayOfYear).$(Rev:r)



variables:
coreVersion: 3
buildConfiguration: 'Release'
buildConfiguration: "Release"
imageRepository: "emberstack/kubernetes-reflector"
DOCKER_CLI_EXPERIMENTAL: 'enabled'

trigger:
branches:
include:
- '*'

pool:
vmImage: 'Ubuntu-16.04'



steps:
- script: |
mkdir -p deploy/helm
mkdir -p deploy/manual
workingDirectory: '$(Build.ArtifactStagingDirectory)'
displayName: 'Create Artifacts directories'

- task: HelmInstaller@0
displayName: 'Install Helm'
inputs:
helmVersion: 2.13.1
kubectlVersion: 1.10.11

- script: 'helm lint'
workingDirectory: helm/reflector
displayName: 'helm lint'

- task: HelmDeploy@0
displayName: 'helm package'
inputs:
connectionType: None
command: package
chartPath: helm/reflector
chartVersion: '$(Build.BuildNumber)'
destination: '$(Build.ArtifactStagingDirectory)/deploy/helm'

- script: 'helm template --namespace kube-system --name reflector reflector > $(Build.ArtifactStagingDirectory)/deploy/manual/reflector-$(Build.BuildNumber).yaml'
workingDirectory: helm
displayName: 'helm template'

- task: Docker@2
displayName: 'Build amd64 image'
inputs:
containerRegistry: 'Emberstack Docker Hub'
repository: emberstack/es.kubernetes.reflector
Dockerfile: ES.Kubernetes.Reflector/Dockerfile
command: build
buildContext: .
tags: 'build-$(Build.BuildNumber)-amd64'

- task: Docker@2
displayName: 'Build arm32 image'
inputs:
containerRegistry: 'Emberstack Docker Hub'
repository: emberstack/es.kubernetes.reflector
Dockerfile: ES.Kubernetes.Reflector/Dockerfile_arch
buildContext: .
command: build
arguments: '--build-arg BASE_IMAGE=emberstack/es.kubernetes.reflector:build-$(Build.BuildNumber)-amd64 --build-arg FINAL_IMAGE=mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim-arm32v7'
tags: 'build-$(Build.BuildNumber)-arm32'

- task: Docker@2
displayName: 'Build arm64 image'
inputs:
containerRegistry: 'Emberstack Docker Hub'
repository: emberstack/es.kubernetes.reflector
Dockerfile: ES.Kubernetes.Reflector/Dockerfile_arch
buildContext: .
command: build
arguments: '--build-arg BASE_IMAGE=emberstack/es.kubernetes.reflector:build-$(Build.BuildNumber)-amd64 --build-arg FINAL_IMAGE=mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim-arm64v8'
tags: 'build-$(Build.BuildNumber)-arm64'


- task: Docker@2
displayName: 'Push images'
inputs:
containerRegistry: 'Emberstack Docker Hub'
repository: emberstack/es.kubernetes.reflector
command: push
tags: |
build-$(Build.BuildNumber)-amd64
build-$(Build.BuildNumber)-arm32
build-$(Build.BuildNumber)-arm64
- task: Docker@2
displayName: 'Docker Hub login'
inputs:
containerRegistry: 'Emberstack Docker Hub'
command: login

- script: |
docker manifest create emberstack/es.kubernetes.reflector:build-$(Build.BuildNumber) emberstack/es.kubernetes.reflector:build-$(Build.BuildNumber)-amd64 emberstack/es.kubernetes.reflector:build-$(Build.BuildNumber)-arm32 emberstack/es.kubernetes.reflector:build-$(Build.BuildNumber)-arm64
docker manifest inspect emberstack/es.kubernetes.reflector:build-$(Build.BuildNumber)
docker manifest push emberstack/es.kubernetes.reflector:build-$(Build.BuildNumber)
displayName: 'Create and push multi-arch manifest'


- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: deploy-chart'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/deploy/helm'
ArtifactName: deploy-chart

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: deploy-manual'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/deploy/manual'
ArtifactName: deploy-manual
- "*"

stages:

- stage: build
displayName: "Build"
jobs:
- job: build
displayName: "Build Job"
pool:
vmImage: "Ubuntu-16.04"
steps:
- script: |
mkdir -p artifacts/helm
mkdir -p artifacts/kubectl
workingDirectory: '$(Build.ArtifactStagingDirectory)'
displayName: 'Create Artifacts directories'
- task: HelmInstaller@0
displayName: 'Install Helm'
inputs:
helmVersion: 2.13.1
kubectlVersion: 1.10.11

- script: 'helm lint'
workingDirectory: helm/reflector
displayName: 'helm lint'

- task: HelmDeploy@0
displayName: 'helm package'
inputs:
connectionType: None
command: package
chartPath: helm/reflector
chartVersion: '$(Build.BuildNumber)'
destination: '$(Build.ArtifactStagingDirectory)/artifacts/helm'

- script: 'helm template --namespace kube-system --name reflector reflector > $(Build.ArtifactStagingDirectory)/artifacts/kubectl/reflector-$(Build.BuildNumber).yaml'
workingDirectory: helm
displayName: 'helm template'

- publish: '$(Build.ArtifactStagingDirectory)/artifacts/helm'
artifact: 'helm'

- publish: '$(Build.ArtifactStagingDirectory)/artifacts/kubectl'
artifact: 'kubectl'

- task: Docker@2
displayName: 'Build amd64 image'
inputs:
containerRegistry: 'Emberstack Docker Hub'
repository: $(imageRepository)
Dockerfile: ES.Kubernetes.Reflector/Dockerfile
command: build
buildContext: .
tags: 'build-$(Build.BuildNumber)-amd64'

- task: Docker@2
displayName: 'Build arm32 image'
inputs:
containerRegistry: 'Emberstack Docker Hub'
repository: $(imageRepository)
Dockerfile: ES.Kubernetes.Reflector/Dockerfile_arch
buildContext: .
command: build
arguments: '--build-arg BASE_IMAGE=$(imageRepository):build-$(Build.BuildNumber)-amd64 --build-arg FINAL_IMAGE=mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim-arm32v7'
tags: 'build-$(Build.BuildNumber)-arm32'

- task: Docker@2
displayName: 'Build arm64 image'
inputs:
containerRegistry: 'Emberstack Docker Hub'
repository: $(imageRepository)
Dockerfile: ES.Kubernetes.Reflector/Dockerfile_arch
buildContext: .
command: build
arguments: '--build-arg BASE_IMAGE=$(imageRepository):build-$(Build.BuildNumber)-amd64 --build-arg FINAL_IMAGE=mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim-arm64v8'
tags: 'build-$(Build.BuildNumber)-arm64'

- task: Docker@2
displayName: "Push images"
inputs:
containerRegistry: "Emberstack Docker Hub"
repository: $(imageRepository)
command: push
tags: |
build-$(Build.BuildNumber)-amd64
build-$(Build.BuildNumber)-arm32
build-$(Build.BuildNumber)-arm64
- task: Docker@2
displayName: "Docker Hub Login"
inputs:
containerRegistry: "Emberstack Docker Hub"
command: login

- script: |
docker manifest create $(imageRepository):build-$(Build.BuildNumber) $(imageRepository):build-$(Build.BuildNumber)-amd64 $(imageRepository):build-$(Build.BuildNumber)-arm32 $(imageRepository):build-$(Build.BuildNumber)-arm64
docker manifest inspect $(imageRepository):build-$(Build.BuildNumber)
docker manifest push $(imageRepository):build-$(Build.BuildNumber)
displayName: "Create and push multi-arch manifest"
- stage: release
displayName: "Release"
dependsOn: 'build'
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'Manual'), in(variables['Build.SourceBranchName'], 'master'))
jobs:
- job: release
displayName: "Release Job"
pool:
vmImage: "Ubuntu-16.04"
variables:
- group: "OpenSource.GitHub"
steps:
- checkout: none

- download: current
artifact: 'helm'

- download: current
artifact: 'kubectl'

- task: Docker@2
displayName: "Docker Login"
inputs:
containerRegistry: "Emberstack Docker Hub"
command: login

- task: HelmInstaller@0
displayName: 'Install Helm'
inputs:
helmVersion: 2.13.1
kubectlVersion: 1.10.11

- script: |
docker pull $(imageRepository):build-$(Build.BuildNumber)-amd64
docker pull $(imageRepository):build-$(Build.BuildNumber)-arm32
docker pull $(imageRepository):build-$(Build.BuildNumber)-arm64
docker manifest create $(imageRepository):release-$(Build.BuildNumber) $(imageRepository):build-$(Build.BuildNumber)-amd64 $(imageRepository):build-$(Build.BuildNumber)-arm32 $(imageRepository):build-$(Build.BuildNumber)-arm64
docker manifest create $(imageRepository):latest $(imageRepository):build-$(Build.BuildNumber)-amd64 $(imageRepository):build-$(Build.BuildNumber)-arm32 $(imageRepository):build-$(Build.BuildNumber)-arm64
docker manifest push $(imageRepository):release-$(Build.BuildNumber)
docker manifest push $(imageRepository):latest
displayName: 'docker pull, tag and push'
- script: |
git config --global user.email "$(emberstack-agent-email)"
git config --global user.name "$(emberstack-agent-name)"
git clone https://$(emberstack-agent-username):$(emberstack-agent-pat)@github.com/EmberStack/helm-charts.git
mkdir -p helm-charts/charts
cp $(Pipeline.Workspace)/helm/reflector-$(Build.BuildNumber).tgz helm-charts/charts
cd helm-charts
rm index.yaml
helm repo index ./
git add .
git status
git commit -m "Added reflector-$(Build.BuildNumber).tgz"
git push
displayName: 'Add chart to GitHub repository'
- script: |
mkdir -p github
cp $(Pipeline.Workspace)/kubectl/reflector-$(Build.BuildNumber).yaml github/reflector.yaml
displayName: 'Prepare GitHub Artifacts'
- task: GitHubRelease@1
displayName: 'GitHub release (create)'
inputs:
gitHubConnection: GitHub
repositoryName: 'EmberStack/kubernetes-reflector'
tagSource: userSpecifiedTag
tag: 'v$(Build.BuildNumber)'
title: 'Release v$(Build.BuildNumber)'
releaseNotesSource: inline
releaseNotes: 'The release process is automated.'
assets: '$(System.DefaultWorkingDirectory)/github/*.*'

4 changes: 2 additions & 2 deletions helm/reflector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ keywords:
- configmaps
- cert-manager
- certificates
home: https://github.com/EmberStack/ES.Kubernetes.Reflector
home: https://github.com/EmberStack/kubernetes-reflector
sources:
- https://github.com/EmberStack/ES.Kubernetes.Reflector
- https://github.com/EmberStack/kubernetes-reflector
maintainers:
- name: winromulus
email: helm-charts@emberstack.com
Expand Down
6 changes: 3 additions & 3 deletions helm/reflector/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Introduction
[Reflector](https://github.com/EmberStack/ES.Kubernetes.Reflector) is a Kubernetes addon designed monitor changes to resources (secrets and configmaps) and reflect changes to mirror resources in the same or other namespaces.
[Reflector](https://github.com/EmberStack/kubernetes-reflector) is a Kubernetes addon designed monitor changes to resources (secrets and configmaps) and reflect changes to mirror resources in the same or other namespaces.

> Supports `amd64`, `arm` and `arm64`
### Extensions
Reflector includes a `cert-manager` extension used to automatically annotate created secrets and allow reflection.

Please see a detailed usage guide on the [Reflector GitHub repository](https://github.com/EmberStack/ES.Kubernetes.Reflector).
Please see a detailed usage guide on the [Reflector GitHub repository](https://github.com/EmberStack/kubernetes-reflector).

## Installing the Chart

Expand All @@ -23,7 +23,7 @@ The configuration parameters in this section control the resources requested and
| ------------------------------------ | ------------------------------------------------ | ------------------------------------------------------- |
| `nameOverride` | Overrides release name | `""` |
| `fullnameOverride` | Overrides release fullname | `""` |
| `image.repository` | Container image repository | `emberstack/es.kubernetes.reflector` |
| `image.repository` | Container image repository | `emberstack/kubernetes-reflector` |
| `image.tag` | Container image tag | `latest` |
| `image.pullPolicy` | Container image pull policy | `Always` if `image.tag` is `latest`, else `IfNotPresent`|
| `extensions.certManager.enabled` | `cert-manager` addon | `true` |
Expand Down

0 comments on commit bebba9c

Please sign in to comment.