Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
258 changes: 150 additions & 108 deletions .devops/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,33 @@ trigger:
exclude:
- .devops
- .github/workflows

pr: none

parameters:
- name: organization
type: string
- name: feed
type: string
- name: package
- name: az_package
type: string
displayName: "Oras package name"
- name: dryrun
displayName: "Execute a dry run?"
type: boolean
default: false
- name: jobs
type: object
default:
azurelinux_8:
new_LTS_image: false
hasExistingImages: true
distro: azurelinux
version: 8
package: temurin-8
image: "image-repository"
tag: "3.0"
distroless_8:
new_LTS_image: false
hasExistingImages: true
distro: distroless
version: 8
package: temurin-8
Expand All @@ -42,21 +48,21 @@ parameters:
base_image: "image-repository"
base_tag: "3.0"
ubuntu_11:
new_LTS_image: false
hasExistingImages: true
distro: ubuntu
version: 11
package: msopenjdk-11
image: "image-repository"
tag: "image-tag"
azurelinux_11:
new_LTS_image: false
hasExistingImages: true
distro: azurelinux
version: 11
package: msopenjdk-11
image: "image-repository"
tag: "3.0"
distroless_11:
new_LTS_image: false
hasExistingImages: true
distro: distroless
version: 11
package: msopenjdk-11
Expand All @@ -65,21 +71,21 @@ parameters:
base_image: "image-repository"
base_tag: "3.0"
ubuntu_17:
new_LTS_image: false
hasExistingImages: true
distro: ubuntu
version: 17
package: msopenjdk-17
image: "image-repository"
tag: "image-tag"
azurelinux_17:
new_LTS_image: false
hasExistingImages: true
distro: azurelinux
version: 17
package: msopenjdk-17
image: "image-repository"
tag: "3.0"
distroless_17:
new_LTS_image: false
hasExistingImages: true
distro: distroless
version: 17
package: msopenjdk-17
Expand All @@ -88,21 +94,21 @@ parameters:
base_image: "image-repository"
base_tag: "3.0"
ubuntu_21:
new_LTS_image: false
hasExistingImages: true
distro: ubuntu
version: 21
package: msopenjdk-21
image: "image-repository"
tag: "image-tag"
azurelinux_21:
new_LTS_image: false
hasExistingImages: true
distro: azurelinux
version: 21
package: msopenjdk-21
image: "image-repository"
tag: "3.0"
distroless_21:
new_LTS_image: false
hasExistingImages: true
distro: distroless
version: 21
package: msopenjdk-21
Expand All @@ -127,70 +133,70 @@ extends:
os: windows
stages:
- stage: build_internal
displayName: "Build Internal"
displayName: Build Internal
variables:
ACR_NAME: msopenjdk
jobs:
- job: build_internal
displayName: "build internal"
pool:
name: JEG-azurelinux-x64-release
os: linux
strategy:
matrix: ${{ parameters.jobs }}
steps:
- task: AzureCLI@2
displayName: "Download ORAS"
condition: ne( variables['new_LTS_image'], true)
inputs:
azureSubscription: "JEG-Infrastructure"
scriptType: "bash"
scriptLocation: "scriptPath"
scriptPath: $(Build.SourcesDirectory)/scripts/install-oras.sh
env:
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
ORAS_VERSION: 1.1.0
ORGANIZATION: ${{ parameters.organization }}
FEED: ${{ parameters.feed }}
NAME: ${{ parameters.package }}
- template: /.devops/templates/prepare-annotation.yml@self
parameters:
registry: $(INTERNAL_ACR_REGISTRY)
tag: $(version)-$(distro)

- bash: |
REGISTRIES=msopenjdk.azurecr.io/internal/private/openjdk/jdk:$(version)-$(distro)
REGISTRIES=$(INTERNAL_ACR_REGISTRY):$(version)-$(distro)
if [[ "$(distro)" == "azurelinux" ]]; then
REGISTRIES+=";msopenjdk.azurecr.io/internal/private/openjdk/jdk:$(version)-mariner"
REGISTRIES+=";$(INTERNAL_ACR_REGISTRY):$(version)-mariner"
fi
echo "##vso[task.setvariable variable=REGISTRIES]$REGISTRIES"
displayName: Set REGISTRIES variable

- task: AzureCLI@2
displayName: Annotate previous image
condition: ne( variables['new_LTS_image'], true)
inputs:
azureSubscription: "JEG-Infrastructure"
scriptType: "bash"
scriptLocation: "scriptPath"
scriptPath: $(Build.SourcesDirectory)/scripts/image-annotation.sh
env:
ACR_NAME: msopenjdk
REGISTRIES: $(REGISTRIES)
- task: AzureCLI@2
inputs:
azureSubscription: "JEG-Infrastructure"
scriptType: "bash"
scriptLocation: "scriptPath"
scriptPath: $(Build.SourcesDirectory)/scripts/build-image.sh
displayName: build image
env:
REGISTRY_TAGS: $(REGISTRIES)
IMAGE: $(image)
TAG: $(tag)
PACKAGE: $(package)
DISTRIBUTION: $(distro)
INSTALLER_IMAGE: $(installer_image)
INSTALLER_TAG: $(installer_tag)
${{ if eq(parameters.dryrun, true) }}:
arguments: >
--image $(image)
--tag $(tag)
--package $(package)
--distribution $(distro)
--registries $(REGISTRIES)
--installer-image $(installer_image)
--installer-tag $(installer_tag)
--dryrun
${{ else }}:
arguments: >
--image $(image)
--tag $(tag)
--package $(package)
--distribution $(distro)
--registries $(REGISTRIES)
--installer-image $(installer_image)
--installer-tag $(installer_tag)
displayName: build container image

- template: /.devops/templates/annotate-image.yml@self
parameters:
registry: $(INTERNAL_ACR_REGISTRY)
organization: ${{ parameters.organization }}
feed: ${{ parameters.feed }}
package: ${{ parameters.az_package }}
dryrun: ${{ parameters.dryrun }}

- stage: validate_and_publish
displayName: "Validate & Publish"
dependsOn: build_internal
jobs:

- job: wait_for_validation
displayName: wait for validation
pool: server
Expand All @@ -203,81 +209,117 @@ extends:
onTimeout: "resume"

- job: build_public
displayName: "build public "
dependsOn: wait_for_validation
pool:
name: JEG-azurelinux-x64-release
os: linux
strategy:
matrix: ${{ parameters.jobs }}
steps:
- task: AzureCLI@2
displayName: "Download ORAS"
condition: ne( variables['new_LTS_image'], true)
inputs:
azureSubscription: "JEG-Infrastructure"
scriptType: "bash"
scriptLocation: "scriptPath"
scriptPath: $(Build.SourcesDirectory)/scripts/install-oras.sh
env:
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
ORAS_VERSION: 1.1.0
ORGANIZATION: ${{ parameters.organization }}
FEED: ${{ parameters.feed }}
NAME: ${{ parameters.package }}
- template: /.devops/templates/prepare-annotation.yml@self
parameters:
registry: $(ACR_REGISTRY)
tag: $(version)-$(distro)

- bash: |
REGISTRIES=msopenjdk.azurecr.io/public/openjdk/jdk:$(version)-$(distro)
TAGS="$(version)-$(distro)"
REGISTRIES=$(ACR_REGISTRY):$(version)-$(distro)
if [[ "$(distro)" == "azurelinux" ]]; then
REGISTRIES+=";msopenjdk.azurecr.io/public/openjdk/jdk:$(version)-mariner"
REGISTRIES+=";$(ACR_REGISTRY):$(version)-mariner"
fi
echo "##vso[task.setvariable variable=REGISTRIES]$REGISTRIES"
echo "##vso[task.setvariable variable=TAGS]$TAGS"
displayName: Set environment variables
displayName: Set REGISTRIES variable

- task: AzureCLI@2
displayName: Annotate previous image
condition: ne( variables['new_LTS_image'], true)
inputs:
azureSubscription: "JEG-Infrastructure"
scriptType: "bash"
scriptLocation: "scriptPath"
scriptPath: $(Build.SourcesDirectory)/scripts/image-annotation.sh
env:
ACR_NAME: msopenjdk
REGISTRIES: $(REGISTRIES)
scriptPath: $(Build.SourcesDirectory)/scripts/build-image.sh
${{ if eq(parameters.dryrun, true) }}:
arguments: >
--image $(image)
--tag $(tag)
--package $(package)
--distribution $(distro)
--registries $(REGISTRIES)
--installer-image $(installer_image)
--installer-tag $(installer_tag)
--dryrun
${{ else }}:
arguments: >
--image $(image)
--tag $(tag)
--package $(package)
--distribution $(distro)
--registries $(REGISTRIES)
--installer-image $(installer_image)
--installer-tag $(installer_tag)
displayName: build container image

- task: AzureCLI@2
inputs:
azureSubscription: "JEG-Infrastructure"
scriptType: "bash"
scriptLocation: "scriptPath"
scriptPath: scripts/build-image.sh
displayName: build image
env:
REGISTRY_TAGS: $(REGISTRIES)
IMAGE: $(image)
TAG: $(tag)
PACKAGE: $(package)
DISTRIBUTION: $(distro)
INSTALLER_IMAGE: $(installer_image)
INSTALLER_TAG: $(installer_tag)
- template: /.devops/templates/annotate-image.yml@self
parameters:
registry: $(ACR_REGISTRY)
organization: ${{ parameters.organization }}
feed: ${{ parameters.feed }}
package: ${{ parameters.az_package }}
dryrun: ${{ parameters.dryrun }}

- task: AzureCLI@2
displayName: Trigger image signing
env:
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
inputs:
azureSubscription: "JEG-Infrastructure"
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: |
az pipelines run \
--branch main \
--org ${{ parameters.organization }} \
--project $(OPENJDK_PROJECT) \
--id $(OPENJDK_SIGNING_ID) \
--parameters openjdk_tags="[$(TAGS)]" \
image_registry="msopenjdk.azurecr.io/public/openjdk" \
image_name="jdk"
# - template: /.devops/templates/annotate-image.yml@self
# parameters:
# registry: $(INTERNAL_ACR_REGISTRY)
# tag: $(version)-$(distro)
# organization: ${{ parameters.organization }}
# feed: ${{ parameters.feed }}
# package: ${{ parameters.az_package }}
# dryrun: ${{ parameters.dryrun }}

# - bash: |
# REGISTRIES=$(ACR_REGISTRY):$(version)-$(distro)
# TAGS="$(version)-$(distro)"

# if [[ "$(distro)" == "azurelinux" ]]; then
# REGISTRIES+=";$(ACR_REGISTRY):$(version)-mariner"
# fi

# echo "##vso[task.setvariable variable=REGISTRIES]$REGISTRIES"
# echo "##vso[task.setvariable variable=TAGS]$TAGS"
# displayName: Set environment variables

# - task: AzureCLI@2
# inputs:
# azureSubscription: "JEG-Infrastructure"
# scriptType: "bash"
# scriptLocation: "scriptPath"
# scriptPath: scripts/build-image.sh
# displayName: Build image
# env:
# REGISTRY_TAGS: $(REGISTRIES)
# IMAGE: $(image)
# TAG: $(tag)
# PACKAGE: $(package)
# DISTRIBUTION: $(distro)
# INSTALLER_IMAGE: $(installer_image)
# INSTALLER_TAG: $(installer_tag)
# ${{ if eq(parameters.dryrun, true) }}:
# DRYRUN: "true"
# ${{ else }}:
# DRYRUN: "false"

- ${{ if ne(parameters.dryrun, true) }}:
- task: AzureCLI@2
displayName: Trigger signing
env:
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
inputs:
azureSubscription: "JEG-Infrastructure"
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: |
az pipelines run \
--branch main \
--org ${{ parameters.organization }} \
--project $(OPENJDK_PROJECT) \
--id $(OPENJDK_SIGNING_ID) \
--parameters openjdk_tags="[$(TAGS)]" \
image_registry="$(ACR_REGISTRY)" \
image_name="jdk"
Loading
Loading