|
| 1 | +parameters: |
| 2 | +- name: images |
| 3 | + type: jobList |
| 4 | + |
| 5 | + |
| 6 | +jobs: |
| 7 | +- ${{ each job_data in parameters.images }}: |
| 8 | + - job: pkg_${{ job_data.job }} |
| 9 | + displayName: "Build Image Package - ${{ job_data.displayName }} -" |
| 10 | + strategy: ${{ job_data.strategy }} |
| 11 | + pool: |
| 12 | + type: linux |
| 13 | + ${{ if eq(job_data.job, 'linux_arm64') }}: |
| 14 | + hostArchitecture: arm64 |
| 15 | + |
| 16 | + variables: |
| 17 | + ob_outputDirectory: $(Build.ArtifactStagingDirectory) |
| 18 | + ob_artifactSuffix: _$(artifact) |
| 19 | + ob_git_checkout: false |
| 20 | + ${{ if eq(job_data.job, 'linux_amd64') }}: |
| 21 | + LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest' |
| 22 | + ARCH: amd64 |
| 23 | + GOARCH: amd64 |
| 24 | + OS: linux |
| 25 | + GOOS: linux |
| 26 | + ${{ elseif eq(job_data.job, 'windows_amd64') }}: |
| 27 | + LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest' |
| 28 | + ARCH: amd64 |
| 29 | + GOARCH: amd64 |
| 30 | + OS: windows |
| 31 | + GOOS: windows |
| 32 | + ${{ elseif eq(job_data.job, 'linux_arm64') }}: |
| 33 | + ob_enable_qemu: true |
| 34 | + ARCH: arm64 |
| 35 | + GOARCH: arm64 |
| 36 | + OS: linux |
| 37 | + GOOS: linux |
| 38 | + # keep these variables concerned with instrumentation. |
| 39 | + ob_outputDirectory: $(Build.ArtifactStagingDirectory) |
| 40 | + GEN_DIR: $(Build.SourcesDirectory)/temp |
| 41 | + REPO_ROOT: $(Build.SourcesDirectory)/${{ job_data.templateContext.repositoryArtifact }} |
| 42 | + OUT_DIR: $(Build.ArtifactStagingDirectory) |
| 43 | + steps: |
| 44 | + - task: DownloadPipelineArtifact@2 |
| 45 | + inputs: |
| 46 | + targetPath: $(REPO_ROOT) |
| 47 | + artifact: '${{ job_data.templateContext.repositoryArtifact }}' |
| 48 | + |
| 49 | + - task: ShellScript@2 |
| 50 | + inputs: |
| 51 | + scriptPath: ${{ job_data.templateContext.buildScript }} |
| 52 | + |
| 53 | + - task: ExtractFiles@1 |
| 54 | + inputs: |
| 55 | + archiveFilePatterns: '**/*.?(tgz|tgz.gz|zip)' |
| 56 | + destinationFolder: $(OUT_DIR) |
| 57 | + cleanDestinationFolder: false |
| 58 | + overwriteExistingFiles: true |
| 59 | + |
| 60 | + - shell: | |
| 61 | + cp "$SOURCE" "$DEST" |
| 62 | + env: |
| 63 | + SOURCE: $(REPO_ROOT)/${{ job_data.templateContext.obDockerfile }} |
| 64 | + DEST: $(OUT_DIR)/Dockerfile |
| 65 | +
|
| 66 | + - task: onebranch.pipeline.signing@1 |
| 67 | + inputs: |
| 68 | + command: 'sign' |
| 69 | + signing_profile: 'external_distribution' |
| 70 | + files_to_sign: '**/*' |
| 71 | + search_root: $(OUT_DIR) |
| 72 | + |
| 73 | + |
| 74 | + - job: images_${{ job_data.job }} |
| 75 | + displayName: "Build Images - ${{ job_data.displayName }} -" |
| 76 | + dependsOn: |
| 77 | + - pkg_${{ job_data.job }} |
| 78 | + strategy: ${{ job_data.strategy }} |
| 79 | + pool: |
| 80 | + os: linux |
| 81 | + type: docker |
| 82 | + ${{ if eq(job_data.job, 'linux_arm64') }}: |
| 83 | + hostArchitecture: arm64 |
| 84 | + LinuxHostVersion: |
| 85 | + distribution: mariner |
| 86 | + architecture: arm64 |
| 87 | + variables: |
| 88 | + ob_outputDirectory: $(Build.SourcesDirectory)/out/images/$(os)_$(arch) |
| 89 | + ob_artifactSuffix: _$(name) |
| 90 | + ob_git_checkout: false |
| 91 | + ${{ if eq(job_data.job, 'linux_amd64') }}: |
| 92 | + LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest' |
| 93 | + ARCH: amd64 |
| 94 | + OS: linux |
| 95 | + ${{ elseif eq(job_data.job, 'windows_amd64') }}: |
| 96 | + ob_enable_qemu: true |
| 97 | + ARCH: amd64 |
| 98 | + OS: windows |
| 99 | + ${{ elseif eq(job_data.job, 'linux_arm64') }}: |
| 100 | + ob_build_container: true |
| 101 | + ARCH: arm64 |
| 102 | + OS: linux |
| 103 | + |
| 104 | + steps: |
| 105 | + - template: build/image.steps.yaml |
| 106 | + parameters: |
| 107 | + arch: $(ARCH) |
| 108 | + os: $(OS) |
| 109 | + name: $(name) |
| 110 | + dockerfile_path: ${{ job_data.templateContext.pkgArtifact }} |
| 111 | + build_tag: $(imageTag) |
| 112 | + extra_args: $(extraArgs) |
| 113 | + archive_file: $(archiveName)-$(OS)-$(ARCH)-$(archiveVersion) |
| 114 | + source: ${{ job_data.templateContext.pkgArtifact }} |
0 commit comments