-
-
Notifications
You must be signed in to change notification settings - Fork 174
155 lines (149 loc) · 6.29 KB
/
build.yml
File metadata and controls
155 lines (149 loc) · 6.29 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Build
on:
push:
pull_request:
branches: [ 'sustaining/15.2.x','master' ]
jobs:
build-maven:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ '11', '17', '21', '25' ]
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Java ${{ matrix.Java }} (${{ matrix.os }})
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-repository-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-repository
- name: Set Integration Test Environment
if: matrix.os == 'ubuntu-latest'
run: |
echo "MAVEN_PROFILE_FLAG=-P integration-test" >> $GITHUB_OUTPUT
echo "MAVEN_VERIFY_STAGE=verify" >> $GITHUB_OUTPUT
echo "127.0.0.1 openam.local" | sudo tee -a /etc/hosts
id: maven-profile-flag
- name: Build with Maven
env:
MAVEN_OPTS: -Dhttps.protocols=TLSv1.2 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true -Dmaven.wagon.http.retryHandler.count=10
run: mvn --batch-mode --errors --update-snapshots package ${{ steps.maven-profile-flag.outputs.MAVEN_VERIFY_STAGE }} --file pom.xml ${{ steps.maven-profile-flag.outputs.MAVEN_PROFILE_FLAG }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.java }}
retention-days: 5
path: |
openam-distribution/openam-distribution-kit/target/*.zip
openam-distribution/openam-distribution-ssoconfiguratortools/target/*.zip
openam-distribution/openam-distribution-fedlet-unconfigured/target/*.zip
openam-distribution/openam-distribution-ssoadmintools/target/*.zip
openam-console/target/*.war
openam-server/target/*.war
openam-server-only/target/*.war
openam-distribution/openam-distribution-docker/Dockerfile*
build-docker:
needs: build-maven
runs-on: 'ubuntu-latest'
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-11
- name: Get latest release version
shell: bash
run: |
export git_version_last="$(curl -i -o - --silent https://api.github.com/repos/OpenIdentityPlatform/OpenAM/releases/latest | grep -m1 "\"name\"" | cut -d\" -f4)" ; echo "last release: $git_version_last"
echo "release_version=$git_version_last" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
localhost:5000/${{ github.repository }}
tags: |
type=raw,value=latest
type=raw,value=${{ env.release_version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Prepare Dockerfile
shell: bash
run: sed -i -E '/^#COPY openam-(server|distribution)\//s/^#//' ./openam-distribution/openam-distribution-docker/Dockerfile
- name: Build image
uses: docker/build-push-action@v5
continue-on-error: true
with:
context: .
file: ./openam-distribution/openam-distribution-docker/Dockerfile
build-args: |
VERSION=${{ env.release_version }}
platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker test
shell: bash
run: |
docker network create test-openam
docker run --rm -it -d --hostname opendj -p 1389:1389 -p 4444:4444 --name test-opendj --network test-openam openidentityplatform/opendj:latest
docker run --rm -it -d --memory="2g" -h openam.example.org --name=test-openam --network test-openam localhost:5000/${GITHUB_REPOSITORY,,}:${{ env.release_version }}
echo "waiting for OpenDJ to be alive..."
timeout 3m bash -c 'until docker inspect --format="{{json .State.Health.Status}}" test-opendj | grep -q \"healthy\"; do sleep 10; done'
echo "waiting for OpenAM to be alive..."
timeout 3m bash -c 'until docker inspect --format="{{json .State.Health.Status}}" test-openam | grep -q \"healthy\"; do sleep 10; done'
docker exec -w '/usr/openam/ssoconfiguratortools' test-openam bash -c \
'echo "ACCEPT_LICENSES=true
SERVER_URL=http://openam.example.org:8080
DEPLOYMENT_URI=/$OPENAM_PATH
BASE_DIR=$OPENAM_DATA_DIR
locale=en_US
PLATFORM_LOCALE=en_US
AM_ENC_KEY=
ADMIN_PWD=ampassword
AMLDAPUSERPASSWD=password
COOKIE_DOMAIN=example.org
DATA_STORE=dirServer
DIRECTORY_SSL=SIMPLE
DIRECTORY_SERVER=opendj
DIRECTORY_PORT=1389
DIRECTORY_ADMIN_PORT=4444
DIRECTORY_JMX_PORT=1689
ROOT_SUFFIX=dc=example,dc=com
DS_DIRMGRDN=cn=Directory Manager
DS_DIRMGRPASSWD=password
USERSTORE_TYPE=LDAPv3ForOpenDS
USERSTORE_SSL=SIMPLE
USERSTORE_HOST=opendj
USERSTORE_PORT=1389
USERSTORE_SUFFIX=dc=example,dc=com
USERSTORE_MGRDN=cn=Directory Manager
USERSTORE_PASSWD=password
" > conf.file && java -jar openam-configurator-tool*.jar --file conf.file'
docker exec test-openam bash -c \
'curl \
--request POST \
--header "Content-Type: application/json" \
--header "X-OpenAM-Username: amadmin" \
--header "X-OpenAM-Password: ampassword" \
--data "{}" \
http://openam.example.org:8080/openam/json/authenticate | grep tokenId'
docker inspect --format="{{json .State.Health.Status}}" test-openam | grep -q \"healthy\"