forked from eclipse-che/che-plugin-registry
-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
1 changed file
with
132 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# Docker image | ||
# Build a Docker image to deploy, run, or push to a container registry. | ||
# Add steps that use Docker Compose, tag images, push to a registry, run an image, and more: | ||
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker | ||
|
||
trigger: | ||
- azure-pipelines | ||
|
||
schedules: | ||
- cron: "20 12 * * *" | ||
displayName: Daily build | ||
branches: | ||
include: | ||
- azure-pipelines | ||
always: true | ||
|
||
variables: | ||
containerRegistry: camino.azurecr.io | ||
organization: camino | ||
imageTag: nightly | ||
|
||
pool: | ||
vmImage: 'Ubuntu-latest' | ||
|
||
jobs: | ||
- job: build | ||
continueOnError: true | ||
steps: | ||
- task: Docker@1 | ||
inputs: | ||
command: login | ||
containerregistrytype: Container Registry | ||
dockerRegistryEndpoint: camino.azurecr.io | ||
|
||
- script: | | ||
BUILDER=docker ./build.sh -r $(containerRegistry) -o $(organization) -t $(imageTag) --offline | ||
displayName: 'docker build' | ||
- script: | | ||
docker push $(containerRegistry)/$(organization)/che-plugin-registry:$(imageTag) | ||
displayName: 'docker push' | ||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/azure-pipelines')) | ||
- job: sync_in_v3 | ||
dependsOn: build | ||
steps: | ||
- task: Docker@1 | ||
inputs: | ||
command: login | ||
containerregistrytype: Container Registry | ||
dockerRegistryEndpoint: camino.azurecr.io | ||
|
||
- task: AzureCLI@2 | ||
displayName: 'Image imports' | ||
inputs: | ||
azureSubscription: 'camino: BizSpark (1fbdb4bb-441e-4922-ba1f-ffd04f533ea1)' | ||
scriptType: bash | ||
scriptLocation: inlineScript | ||
inlineScript: 'grep -r image: v3 | grep -v registry.access.redhat.com | awk ''!/camino/ { print $NF }'' | sort | uniq | awk ''{ print "az acr import --force --name camino --source " $NF}'' | sh -x' | ||
condition: and(succeeded('build'), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/azure-pipelines')) | ||
|
||
- job: sync_in_yaml | ||
dependsOn: build | ||
steps: | ||
- task: Docker@1 | ||
inputs: | ||
command: login | ||
containerregistrytype: Container Registry | ||
dockerRegistryEndpoint: camino.azurecr.io | ||
|
||
- task: AzureCLI@2 | ||
displayName: 'Image imports' | ||
inputs: | ||
azureSubscription: 'camino: BizSpark (1fbdb4bb-441e-4922-ba1f-ffd04f533ea1)' | ||
scriptType: bash | ||
scriptLocation: inlineScript | ||
inlineScript: 'grep image: che-theia-plugins.yaml | grep -v registry.access.redhat.com | awk ''!/camino/ { print $NF }'' | sort | uniq | awk ''{ print "az acr import --force --name camino --source " $NF}'' | sh -x' | ||
condition: and(succeeded('build'), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/azure-pipelines')) | ||
|
||
- job: build_publish_sidecars_to_camino | ||
displayName: build-publish sidecars to camino. | ||
steps: | ||
- task: Docker@1 | ||
inputs: | ||
command: login | ||
containerregistrytype: Container Registry | ||
dockerRegistryEndpoint: camino.azurecr.io | ||
- script: sed -i -e 's/quay.io\/eclipse/camino.azurecr.io\/camino/g' .ci/sidecar-build-publish.sh | ||
- script: docker run --privileged --rm tonistiigi/binfmt --install arm64 | ||
- script: docker run --privileged --rm tonistiigi/binfmt | ||
- script: docker buildx create --use | ||
- script: .ci/sidecar-build-publish.sh build-publish origin/azure-pipelines `git rev-parse HEAD` | ||
#condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/azure-pipelines')) | ||
|
||
- job: build_sidecars | ||
displayName: build sidecars only in CI. | ||
steps: | ||
- task: Docker@1 | ||
inputs: | ||
command: login | ||
containerregistrytype: Container Registry | ||
dockerRegistryEndpoint: camino.azurecr.io | ||
- script: sed -i -e 's/quay.io\/eclipse/camino.azurecr.io\/camino/g' .ci/sidecar-build-publish.sh | ||
- script: docker run --privileged --rm tonistiigi/binfmt --install arm64 | ||
- script: docker run --privileged --rm tonistiigi/binfmt | ||
- script: docker buildx create --use | ||
- script: .ci/sidecar-build-publish.sh build origin/azure-pipelines `git rev-parse HEAD` | ||
- script: | | ||
sed -i -e 's/quay.io\/eclipse/camino.azurecr.io\/camino/g' .ci/sidecar-build-publish.sh | ||
docker run --privileged --rm tonistiigi/binfmt --install arm64 | ||
docker run --privileged --rm tonistiigi/binfmt | ||
docker buildx create --use | ||
.ci/sidecar-build-publish.sh build origin/azure-pipelines `git rev-parse HEAD` | ||
condition: eq(variables['Build.Reason'], 'PullRequest') | ||
|
||
- job: sync_in_quay | ||
dependsOn: build | ||
steps: | ||
- task: Docker@1 | ||
inputs: | ||
command: login | ||
containerregistrytype: Container Registry | ||
dockerRegistryEndpoint: camino.azurecr.io | ||
|
||
- task: AzureCLI@2 | ||
displayName: 'Image imports' | ||
inputs: | ||
azureSubscription: 'camino: BizSpark (1fbdb4bb-441e-4922-ba1f-ffd04f533ea1)' | ||
scriptType: bash | ||
scriptLocation: inlineScript | ||
inlineScript: 'for i in 1 2 3; do curl "https://quay.io/api/v1/repository/eclipse/che-plugin-sidecar/tag/?limit=100&page=$i" | jq -r ''.tags[].name'' | sort | uniq | awk ''{ print "az acr repository show --name camino --image eclipse/che-plugin-sidecar:" $NF; print "if [ $? -ne 0 ]; then az acr import --name camino --source quay.io/eclipse/che-plugin-sidecar:" $NF "; fi"}''; done | sh -x' | ||
condition: and(succeeded('build'), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/azure-pipelines')) |