-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c3b6bc
commit 02a5e24
Showing
3 changed files
with
149 additions
and
154 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,74 @@ | ||
parameters: | ||
architectures: [] | ||
|
||
|
||
stages: | ||
- stage: cd | ||
displayName: "CD" | ||
dependsOn: 'ci' | ||
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'Manual'), in(variables['Build.SourceBranchName'], 'master')) | ||
jobs: | ||
- job: release | ||
displayName: "Release" | ||
pool: | ||
vmImage: ubuntu-latest | ||
variables: | ||
- group: "OpenSource.GitHub" | ||
- name: "manifest.images" | ||
value: "" | ||
steps: | ||
- checkout: none | ||
- download: current | ||
artifact: 'helm' | ||
displayName: "Download helm artifact" | ||
- task: DockerInstaller@0 | ||
displayName: 'Docker install' | ||
inputs: | ||
dockerVersion: '19.03.5' | ||
- task: Docker@2 | ||
displayName: "Docker login" | ||
inputs: | ||
containerRegistry: "Emberstack Docker Hub" | ||
command: login | ||
- task: HelmInstaller@1 | ||
inputs: | ||
helmVersionToInstall: '3.1.1' | ||
displayName: "Helm install" | ||
- ${{ each architecture in parameters.architectures }}: | ||
- script: | | ||
docker pull $(imageRepository):build-$(Build.BuildNumber)-${{ architecture.arch }} | ||
echo '##vso[task.setvariable variable=manifest.images]$(manifest.images) $(imageRepository):build-$(Build.BuildNumber)-${{ architecture.arch }}' | ||
docker tag $(imageRepository):build-$(Build.BuildNumber)-${{ architecture.arch }} $(imageRepository):$(Build.BuildNumber)-${{ architecture.arch }} | ||
docker push $(imageRepository):$(Build.BuildNumber)-${{ architecture.arch }} | ||
displayName: "Retag ${{ architecture.arch }} image" | ||
- script: | | ||
docker manifest create $(imageRepository):$(Build.BuildNumber) $(manifest.images) | ||
docker manifest push $(imageRepository):$(Build.BuildNumber) | ||
docker manifest create $(imageRepository):latest $(manifest.images) | ||
docker manifest push $(imageRepository):latest | ||
displayName: 'Create and push multi-arch manifest' | ||
- 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/sftp-$(Build.BuildNumber).tgz helm-charts/charts | ||
cd helm-charts | ||
rm index.yaml | ||
helm repo index ./ | ||
git add . | ||
git status | ||
git commit -m "Added sftp-$(Build.BuildNumber).tgz" | ||
git push | ||
displayName: 'Add chart to GitHub repository' | ||
- task: GitHubRelease@1 | ||
displayName: 'GitHub release (create)' | ||
inputs: | ||
gitHubConnection: GitHub | ||
repositoryName: 'emberstack/docker-sftp' | ||
tagSource: userSpecifiedTag | ||
tag: 'v$(Build.BuildNumber)' | ||
title: 'Release v$(Build.BuildNumber)' | ||
releaseNotesSource: inline | ||
releaseNotes: 'The release process is automated.' | ||
- stage: cd | ||
displayName: "CD" | ||
dependsOn: "ci" | ||
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'Manual'), in(variables['Build.SourceBranchName'], 'master')) | ||
jobs: | ||
- job: release | ||
displayName: "Release" | ||
pool: | ||
vmImage: ubuntu-latest | ||
variables: | ||
- group: "OpenSource.GitHub" | ||
- name: "manifest.images" | ||
value: "" | ||
steps: | ||
- checkout: none | ||
- download: current | ||
artifact: "helm" | ||
displayName: "Download helm artifact" | ||
- task: DockerInstaller@0 | ||
displayName: "Docker install" | ||
inputs: | ||
dockerVersion: "19.03.5" | ||
- task: Docker@2 | ||
displayName: "Docker login" | ||
inputs: | ||
containerRegistry: "Emberstack Docker Hub" | ||
command: login | ||
- task: HelmInstaller@1 | ||
inputs: | ||
helmVersionToInstall: "3.1.1" | ||
displayName: "Helm install" | ||
- ${{ each architecture in parameters.architectures }}: | ||
- script: | | ||
docker pull $(imageRepository):build-$(Build.BuildNumber)-${{ architecture.arch }} | ||
echo '##vso[task.setvariable variable=manifest.images]$(manifest.images) $(imageRepository):build-$(Build.BuildNumber)-${{ architecture.arch }}' | ||
docker tag $(imageRepository):build-$(Build.BuildNumber)-${{ architecture.arch }} $(imageRepository):$(Build.BuildNumber)-${{ architecture.arch }} | ||
docker push $(imageRepository):$(Build.BuildNumber)-${{ architecture.arch }} | ||
displayName: "Retag ${{ architecture.arch }} image" | ||
- script: | | ||
docker manifest create $(imageRepository):$(Build.BuildNumber) $(manifest.images) | ||
docker manifest push $(imageRepository):$(Build.BuildNumber) | ||
docker manifest create $(imageRepository):latest $(manifest.images) | ||
docker manifest push $(imageRepository):latest | ||
displayName: "Create and push multi-arch manifest" | ||
- 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/sftp-$(Build.BuildNumber).tgz helm-charts/charts | ||
cd helm-charts | ||
rm index.yaml | ||
helm repo index ./ | ||
git add . | ||
git status | ||
git commit -m "Added sftp-$(Build.BuildNumber).tgz" | ||
git push | ||
displayName: "Add chart to GitHub repository" | ||
- task: GitHubRelease@1 | ||
displayName: "GitHub release (create)" | ||
inputs: | ||
gitHubConnection: GitHub | ||
repositoryName: "emberstack/docker-sftp" | ||
tagSource: userSpecifiedTag | ||
tag: "v$(Build.BuildNumber)" | ||
title: "Release v$(Build.BuildNumber)" | ||
releaseNotesSource: inline | ||
releaseNotes: "The release process is automated." |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,66 @@ | ||
parameters: | ||
architectures: [] | ||
|
||
|
||
stages: | ||
- stage: ci | ||
displayName: "CI" | ||
jobs: | ||
- job: build_helm | ||
displayName: "Helm" | ||
pool: | ||
vmImage: ubuntu-latest | ||
steps: | ||
- script: | | ||
mkdir -p artifacts/helm | ||
workingDirectory: '$(Build.ArtifactStagingDirectory)' | ||
displayName: 'Create Artifacts directories' | ||
- task: HelmInstaller@1 | ||
inputs: | ||
helmVersionToInstall: '3.1.1' | ||
displayName: "Helm install" | ||
- script: | | ||
cp README.md src/deploy/helm/sftp/README.md | ||
displayName: 'import README' | ||
- script: | | ||
helm package --destination $(Build.ArtifactStagingDirectory)/artifacts/helm --version $(Build.BuildNumber) --app-version $(Build.BuildNumber) src/deploy/helm/sftp | ||
displayName: 'Helm package chart' | ||
- publish: '$(Build.ArtifactStagingDirectory)/artifacts/helm' | ||
artifact: 'helm' | ||
displayName: "Publish helm artifact" | ||
|
||
|
||
- ${{ each architecture in parameters.architectures }}: | ||
- template: jobs.ci.build.docker.yaml | ||
parameters: | ||
arch: ${{ architecture.arch }} | ||
pool: ${{ architecture.pool }} | ||
- stage: ci | ||
displayName: "CI" | ||
jobs: | ||
- job: build_helm | ||
displayName: "Helm" | ||
pool: | ||
vmImage: ubuntu-latest | ||
steps: | ||
- script: | | ||
mkdir -p artifacts/helm | ||
workingDirectory: "$(Build.ArtifactStagingDirectory)" | ||
displayName: "Create Artifacts directories" | ||
- task: HelmInstaller@1 | ||
inputs: | ||
helmVersionToInstall: "3.1.1" | ||
displayName: "Helm install" | ||
- script: | | ||
cp README.md src/deploy/helm/sftp/README.md | ||
displayName: "import README" | ||
- script: | | ||
helm package --destination $(Build.ArtifactStagingDirectory)/artifacts/helm --version $(Build.BuildNumber) --app-version $(Build.BuildNumber) src/deploy/helm/sftp | ||
displayName: "Helm package chart" | ||
- publish: "$(Build.ArtifactStagingDirectory)/artifacts/helm" | ||
artifact: "helm" | ||
displayName: "Publish helm artifact" | ||
|
||
|
||
- job: build_docker_multiarch | ||
displayName: "Docker multiarch image" | ||
pool: | ||
vmImage: ubuntu-latest | ||
dependsOn: | ||
- ${{ each architecture in parameters.architectures }}: | ||
- build_docker_${{ architecture.arch}} | ||
variables: | ||
- name: "manifest.images" | ||
value: "" | ||
steps: | ||
- task: DockerInstaller@0 | ||
displayName: 'Docker install' | ||
inputs: | ||
dockerVersion: '19.03.5' | ||
- task: Docker@2 | ||
displayName: "Docker login" | ||
inputs: | ||
containerRegistry: "Emberstack Docker Hub" | ||
command: login | ||
- ${{ each architecture in parameters.architectures }}: | ||
- script: | | ||
docker pull $(imageRepository):build-$(Build.BuildNumber)-${{ architecture.arch }} | ||
echo '##vso[task.setvariable variable=manifest.images]$(manifest.images) $(imageRepository):build-$(Build.BuildNumber)-${{ architecture.arch }}' | ||
displayName: "Pull ${{ architecture.arch }} image" | ||
- script: | | ||
docker manifest create $(imageRepository):build-$(Build.BuildNumber) $(manifest.images) | ||
docker manifest inspect $(imageRepository):build-$(Build.BuildNumber) | ||
docker manifest push $(imageRepository):build-$(Build.BuildNumber) | ||
displayName: "Create and push multi-arch manifest" | ||
- template: jobs.ci.build.docker.yaml | ||
parameters: | ||
arch: ${{ architecture.arch }} | ||
pool: ${{ architecture.pool }} | ||
|
||
- job: build_docker_multiarch | ||
displayName: "Docker multiarch image" | ||
pool: | ||
vmImage: ubuntu-latest | ||
dependsOn: | ||
- ${{ each architecture in parameters.architectures }}: | ||
- build_docker_${{ architecture.arch}} | ||
variables: | ||
- name: "manifest.images" | ||
value: "" | ||
steps: | ||
- task: DockerInstaller@0 | ||
displayName: "Docker install" | ||
inputs: | ||
dockerVersion: "19.03.5" | ||
- task: Docker@2 | ||
displayName: "Docker login" | ||
inputs: | ||
containerRegistry: "Emberstack Docker Hub" | ||
command: login | ||
- ${{ each architecture in parameters.architectures }}: | ||
- script: | | ||
docker pull $(imageRepository):build-$(Build.BuildNumber)-${{ architecture.arch }} | ||
echo '##vso[task.setvariable variable=manifest.images]$(manifest.images) $(imageRepository):build-$(Build.BuildNumber)-${{ architecture.arch }}' | ||
displayName: "Pull ${{ architecture.arch }} image" | ||
- script: | | ||
docker manifest create $(imageRepository):build-$(Build.BuildNumber) $(manifest.images) | ||
docker manifest inspect $(imageRepository):build-$(Build.BuildNumber) | ||
docker manifest push $(imageRepository):build-$(Build.BuildNumber) | ||
displayName: "Create and push multi-arch manifest" |
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