Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheyla Trudo committed Nov 26, 2024
1 parent 2e67633 commit 8cbdf0e
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 265 deletions.
File renamed without changes.
File renamed without changes.
89 changes: 61 additions & 28 deletions .pipelines/containers/build-variables-template.steps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,66 @@ parameters:


steps:
- bash: |
set -e

VAR_ID="${IMAGE}_${OS}_${ARCH}"
- ${{ if eq(parameters.targetOs, 'linux') }}:
- bash: |
set -e
VAR_ID="${IMAGE}_${OS}_${ARCH}"
BUILD_CONTEXT=$(make "$MAKE_BUILD_CONTEXT")
echo >&2 "##vso[task.setvariable variable=BUILD_CONTEXT_${VAR_ID};]$BUILD_CONTEXT"
IMAGE_PLATFORM_TAG=$(make "$MAKE_IMAGE_TAG")
echo >&2 "##vso[task.setvariable variable=IMAGE_PLATFORM_TAG_${VAR_ID};]$IMAGE_PLATFORM_TAG"
IMAGE_NAME_AND_TAG=$(make "$MAKE_IMAGE_NAME_AND_TAG")
echo >&2 "##vso[task.setvariable variable=IMAGE_NAME_AND_TAG_${VAR_ID};]$IMAGE_NAME_AND_TAG"
DOCKERFILE_PATH=$(make "$MAKE_DOCKERFILE_PATH")
echo >&2 "##vso[task.setvariable variable=DOCKERFILE_PATH_${VAR_ID};]$DOCKERFILE_PATH"
EXTRA_BUILD_ARGS=$(make "$MAKE_EXTRA_BUILD_ARGS")
echo >&2 "##vso[task.setvariable variable=EXTRA_BUILD_ARGS_${VAR_ID};]$EXTRA_BUILD_ARGS"
displayName: "Get Image Build Data"
env:
IMAGE: ${{ parameters.image }}
OS: ${{ parameters.targetOs }}
ARCH: ${{ parameters.targetArch }}
PLATFORM: ${{ parameters.targetOs }}/${{ parameters.targetArch }}
MAKE_IMAGE_TAG: ${{ parameters.image }}-image-tag
MAKE_BUILD_CONTEXT: ${{ parameters.image }}-image-build-context
MAKE_IMAGE_NAME_AND_TAG: ${{ parameters.image }}-image-name-and-tag
MAKE_DOCKERFILE_PATH: ${{ parameters.image }}-dockerfile-path
MAKE_EXTRA_BUILD_ARGS: ${{ parameters.image }}-docker-build-args
BUILD_CONTEXT=$(make "$MAKE_BUILD_CONTEXT")
echo >&2 "##vso[task.setvariable variable=BUILD_CONTEXT_${VAR_ID};]$BUILD_CONTEXT"
IMAGE_PLATFORM_TAG=$(make "$MAKE_IMAGE_TAG")
echo >&2 "##vso[task.setvariable variable=IMAGE_PLATFORM_TAG_${VAR_ID};]$IMAGE_PLATFORM_TAG"
IMAGE_NAME_AND_TAG=$(make "$MAKE_IMAGE_NAME_AND_TAG")
echo >&2 "##vso[task.setvariable variable=IMAGE_NAME_AND_TAG_${VAR_ID};]$IMAGE_NAME_AND_TAG"
DOCKERFILE_PATH=$(make "$MAKE_DOCKERFILE_PATH")
echo >&2 "##vso[task.setvariable variable=DOCKERFILE_PATH_${VAR_ID};]$DOCKERFILE_PATH"
EXTRA_BUILD_ARGS=$(make "$MAKE_EXTRA_BUILD_ARGS")
echo >&2 "##vso[task.setvariable variable=EXTRA_BUILD_ARGS_${VAR_ID};]$EXTRA_BUILD_ARGS"
displayName: "Get Image Build Data"
env:
IMAGE: ${{ parameters.image }}
OS: ${{ parameters.targetOs }}
ARCH: ${{ parameters.targetArch }}
PLATFORM: ${{ parameters.targetOs }}/${{ parameters.targetArch }}
MAKE_IMAGE_TAG: ${{ parameters.image }}-image-tag
MAKE_BUILD_CONTEXT: ${{ parameters.image }}-image-build-context
MAKE_IMAGE_NAME_AND_TAG: ${{ parameters.image }}-image-name-and-tag
MAKE_DOCKERFILE_PATH: ${{ parameters.image }}-dockerfile-path
MAKE_EXTRA_BUILD_ARGS: ${{ parameters.image }}-docker-build-args
- ${{ elseif eq(parameters.targetOs, 'windows') }}:
- pwsh: |
$env:VAR_ID = "$env:IMAGE_$env:OS_$env:ARCH"
$env:BUILD_CONTEXT = (make "$env:MAKE_BUILD_CONTEXT")
Write-Host "##vso[task.setvariable variable=BUILD_CONTEXT_$env:VAR_ID;]$env:BUILD_CONTEXT"
$env:IMAGE_PLATFORM_TAG = (make "$env:MAKE_IMAGE_TAG")
Write-Host "##vso[task.setvariable variable=IMAGE_PLATFORM_TAG_$env:VAR_ID;]$env:IMAGE_PLATFORM_TAG"
$env:IMAGE_NAME_AND_TAG = (make "$env:MAKE_IMAGE_NAME_AND_TAG")
Write-Host "##vso[task.setvariable variable=IMAGE_NAME_AND_TAG_$env:VAR_ID;]$env:IMAGE_NAME_AND_TAG"
$env:DOCKERFILE_PATH = (make "$env:MAKE_DOCKERFILE_PATH")
Write-Host "##vso[task.setvariable variable=DOCKERFILE_PATH_$env:VAR_ID;]$env:DOCKERFILE_PATH"
$env:EXTRA_BUILD_ARGS = (make "$env:MAKE_EXTRA_BUILD_ARGS")
Write-Host "##vso[task.setvariable variable=EXTRA_BUILD_ARGS_$env:VAR_ID;]$env:EXTRA_BUILD_ARGS"
displayName: "Get Image Build Data"
errorActionPreference: stop
env:
IMAGE: ${{ parameters.image }}
OS: ${{ parameters.targetOs }}
ARCH: ${{ parameters.targetArch }}
PLATFORM: ${{ parameters.targetOs }}/${{ parameters.targetArch }}
MAKE_IMAGE_TAG: ${{ parameters.image }}-image-tag
MAKE_BUILD_CONTEXT: ${{ parameters.image }}-image-build-context
MAKE_IMAGE_NAME_AND_TAG: ${{ parameters.image }}-image-name-and-tag
MAKE_DOCKERFILE_PATH: ${{ parameters.image }}-dockerfile-path
MAKE_EXTRA_BUILD_ARGS: ${{ parameters.image }}-docker-build-args
53 changes: 0 additions & 53 deletions .pipelines/containers/build-variables-template.windows.steps.yaml

This file was deleted.

72 changes: 0 additions & 72 deletions .pipelines/containers/container-template.jobs.yaml

This file was deleted.

51 changes: 0 additions & 51 deletions .pipelines/containers/container-template.steps.yaml

This file was deleted.

22 changes: 8 additions & 14 deletions .pipelines/containers/containerize.jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
- ${{ each imageName in parameters.images }}:
- job: ${{ replace(format('{0}_{1}_{2}', imageName, parameters.targetOs, parameters.targetArch), '-', '_') }}
displayName: Build Image - (${{ imageName }} ${{ parameters.targetOs }}/${{ parameters.targetArch }})
variables:

variables:
buildPlatform: ${{ parameters.buildOs }}/${{ parameters.buildArch }}
targetPlatform: ${{ parameters.targetOs }}/${{ parameters.targetArch }}

Expand All @@ -60,20 +61,13 @@ jobs:
# - BUILD_CONTEXT_${image}_${OS}_${ARCH}}
# - IMAGE_PLATFORM_TAG_${image}_${OS}_${ARCH}}
# - EXTRA_BUILD_ARGS_$${image}_${OS}_${ARCH}}
- ${{ if eq(parameters.targetOs, 'windows') }}:
- template: /.pipelines/containers/build-variables-template.windows.steps.yaml
parameters:
targetOs: ${{ parameters.targetOs }}
targetArch: ${{ parameters.targetArch }}
image: ${{ imageName }}
- ${{ else }}:
- template: /.pipelines/containers/build-variables-template.steps.yaml
parameters:
targetOs: ${{ parameters.targetOs }}
targetArch: ${{ parameters.targetArch }}
image: ${{ imageName }}
- template: /.pipelines/containers/build-variables-template.steps.yaml
parameters:
targetOs: ${{ parameters.targetOs }}
targetArch: ${{ parameters.targetArch }}
image: ${{ imageName }}

- template: ./container-template.steps.yaml
- template: ./containerize.steps.yaml
parameters:
imageNameAndTag: $(IMAGE_NAME_AND_TAG_${{ imageName }}_${{ parameters.targetOs }}_${{ parameters.targetArch }})
dockerfilePath: $(DOCKERFILE_PATH_${{ imageName }}_${{ parameters.targetOs }}_${{ parameters.targetArch }})
Expand Down
Loading

0 comments on commit 8cbdf0e

Please sign in to comment.