forked from trinodb/trino-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
108 lines (93 loc) · 3.44 KB
/
azure-pipelines.yml
File metadata and controls
108 lines (93 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
trigger:
branches:
include:
- main
resources:
- repo: self
variables:
buildTimestamp: $[format('{0:yyyyMMddHHmmss}', pipeline.startTime)]
containerRegistry: uchimera
DOCKER_BUILDKIT: 1
MAVEN: './mvnw -B'
m2RepoNodePath: /datadisks/disk1/.m2/repository
m2RepoContainerPath: /tmp/m2/repository
jdkReleaseName: 24.0.2+12
container:
image: uchimera.azurecr.io/cccs/dev/trino-build:478_trino-478-merge-fixes
options: --entrypoint="" --user=0 -e M2_STRATUS_TOKEN
endpoint: uchimera
volumes:
- "${{ variables.m2RepoNodePath }}:${{ variables.m2RepoContainerPath }}"
- "/root/.m2/settings.xml:/root/.m2/settings.xml"
pool: cybertron-build-pool
steps:
- bash: |
BRANCH_NAME=`echo "$SYSTEM_PULLREQUEST_SOURCEBRANCH $BUILD_SOURCEBRANCH" | sed -r 's/^\s*(refs\/heads\/)?(\S*).*$/\2/' | sed 's/\//_/g'`
echo "##vso[task.setvariable variable=BRANCH_NAME]$BRANCH_NAME"
displayName: Parse Source Control Branch Name
- task: Docker@2
displayName: Login to $(containerRegistry)
inputs:
command: login
containerRegistry: $(containerRegistry)
- script: |
VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "##vso[task.setvariable variable=trinoVersion]$VERSION"
displayName: Extract Trino Gateway Version
- task: Maven@4
displayName: Build Trino Gateway JAR
inputs:
mavenPomFile: 'gateway-ha/pom.xml'
goals: 'clean package'
options: '-DskipTests'
- task: Bash@3
displayName: Prepare Docker build context
inputs:
targetType: 'inline'
script: |
set -eux
# Create Docker build context directory
WORK_DIR="$(Build.SourcesDirectory)/docker-build-context"
rm -rf "$WORK_DIR"
mkdir -p "$WORK_DIR/gateway-ha"
# Copy Maven-built JAR and rename, scripts and Dockerfile
cp gateway-ha/target/gateway-ha-*-jar-with-dependencies.jar "$WORK_DIR/gateway-ha/gateway-ha-jar-with-dependencies.jar"
cp -R docker/bin "$WORK_DIR/gateway-ha"
cp docker/Dockerfile "$WORK_DIR/"
# Output the contents for debugging
ls -l "$WORK_DIR/gateway-ha"
ls -l "$WORK_DIR"
- task: Docker@2
displayName: Build Docker image
env:
DOCKER_BUILDKIT: 1
# Full logs for CI build
BUILDKIT_PROGRESS: plain
inputs:
command: build
repository: trinodb/trino-gateway
Dockerfile: "$(Build.SourcesDirectory)/docker-build-context/Dockerfile"
tags: |
$(BRANCH_NAME)
$(BRANCH_NAME)_$(buildTimestamp)_b$(Build.BuildId)
buildContext: "$(Build.SourcesDirectory)/docker-build-context"
arguments: >
--build-arg TRINO_GATEWAY_BASE_IMAGE=registry.access.redhat.com/ubi10/ubi-micro:latest
--build-arg TRINO_GATEWAY_BUILD_IMAGE=registry.access.redhat.com/ubi10/ubi:latest
--build-arg JDK_RELEASE_NAME=$(jdkReleaseName)
--build-arg JDK_DOWNLOAD_LINK=https://api.adoptium.net/v3/binary/version/jdk-$(jdkReleaseName)/linux/x64/jdk/hotspot/normal/eclipse?project=jdk
- task: Docker@2
displayName: Push image
inputs:
command: "push"
containerRegistry: $(containerRegistry)
repository: trinodb/trino-gateway
tags: |
$(BRANCH_NAME)
$(BRANCH_NAME)_$(buildTimestamp)_b$(Build.BuildId)
- task: Docker@2
displayName: Logout of $(containerRegistry)
inputs:
command: logout
containerRegistry: $(containerRegistry)
condition: always()