-
Notifications
You must be signed in to change notification settings - Fork 11
173 lines (152 loc) · 6 KB
/
Copy pathbuild.yaml
File metadata and controls
173 lines (152 loc) · 6 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#
# Copyright contributors to the Galasa project
#
# SPDX-License-Identifier: EPL-2.0
#
name: Main build
on:
workflow_dispatch:
push:
branches: [main]
env:
REGISTRY: ghcr.io
NAMESPACE: ${{ github.repository_owner }}
BRANCH: ${{ github.ref_name }}
jobs:
check-required-secrets-configured:
name: Check required secrets configured
uses: galasa-dev/galasa/.github/workflows/check-required-secrets-configured.yaml@main
with:
check_write_github_packages_username: 'true'
check_write_github_packages_token: 'true'
secrets:
WRITE_GITHUB_PACKAGES_TOKEN: ${{ secrets.WRITE_GITHUB_PACKAGES_TOKEN }}
build-integrationtests:
name: Building the Integration Tests Repository
runs-on: ubuntu-latest
needs: check-required-secrets-configured
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'semeru'
cache: maven
- name: Print githash
run: |
echo $GITHUB_SHA > ./inttests.githash
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 9.0.0
cache-disabled: true
- name: Build Integration Tests with Gradle
working-directory: galasa-inttests-parent
run: |
set -o pipefail
gradle publish publishToMavenLocal --info \
--no-daemon --console plain \
-PsourceMaven=https://development.galasa.dev/main/maven-repo/obr \
-PcentralMaven=https://repo.maven.apache.org/maven2/ \
-PtargetMaven=${{ github.workspace }}/repo 2>&1 | tee gradle-build.log
- name: Upload Gradle Build Log
if: failure()
uses: actions/upload-artifact@v4
with:
name: inttests-gradle-build-log
path: gradle-build.log
retention-days: 7
- name: Building Integration Tests Test Catalog with Maven
run: |
set -o pipefail
mvn -f galasa-inttests-parent/dev.galasa.inttests.obr/pom.xml deploy -X \
-Dgalasa.source.repo=https://development.galasa.dev/main/maven-repo/obr \
-Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \
-Dgalasa.release.repo=file:${{ github.workspace }}/repo \
-Dgalasa.skip.deploytestcatalog=true \
-Dgalasa.skip.bundletestcatalog=false \
--batch-mode --errors --fail-at-end \
--settings ${{ github.workspace }}/settings.xml 2>&1 | tee maven-build.log
- name: Upload Maven Build Log
if: failure()
uses: actions/upload-artifact@v4
with:
name: inttests-obr-maven-build-log
path: maven-build.log
retention-days: 7
- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ vars.WRITE_GITHUB_PACKAGES_USERNAME }}
password: ${{ secrets.WRITE_GITHUB_PACKAGES_TOKEN }}
- name: Extract metadata for Integration Tests image
id: metadata
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/inttests-maven-artefacts
- name: Build Integration Tests image for development Maven registry
id: build
uses: docker/build-push-action@v5
with:
context: .
file: dockerfiles/dockerfile.inttests
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: |
baseVersion=latest
dockerRepository=${{ env.REGISTRY }}
branch=${{ env.BRANCH }}
- name: Recycle application in ArgoCD
# Skip this step for forks
if: ${{ github.repository_owner == 'galasa-dev' }}
env:
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }}
run: |
for i in {1..10}; do
docker run \
--env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} \
--rm ghcr.io/${{ env.NAMESPACE }}/argocdcli:main \
app actions run main-inttests restart \
--kind Deployment \
--resource-name inttests-main \
--server argocd.galasa.dev \
--grpc-web \
&& exit 0 || sleep 10
done
echo "ArgoCD still uncontactable after 10 attempts."
exit 1
- name: Wait for app health in ArgoCD
# Skip this step for forks
if: ${{ github.repository_owner == 'galasa-dev' }}
env:
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }}
run: |
for i in {1..10}; do
docker run \
--env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} \
--rm ghcr.io/${{ env.NAMESPACE }}/argocdcli:main \
app wait main-inttests \
--resource apps:Deployment:inttests-main \
--health \
--server argocd.galasa.dev \
--grpc-web \
&& exit 0 || sleep 10
done
echo "ArgoCD still uncontactable after 10 attempts."
exit 1
report-failure:
# Skip this job for forks
if: ${{ failure() && github.repository_owner == 'galasa-dev' }}
name: Report failure in workflow
runs-on: ubuntu-latest
needs: [build-integrationtests]
steps:
- name: Report failure in workflow to Slack
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
run : |
docker run --rm ghcr.io/galasa-dev/galasabld-ibm:main slackpost workflows --repo "integratedtests" --workflowName "${{ github.workflow }}" --workflowRunNum "${{ github.run_id }}" --ref "${{ env.BRANCH }}" --hook "${{ env.SLACK_WEBHOOK }}"