Skip to content

Commit 113a57f

Browse files
authored
Finish migrating packaging pipeline to Github Actions. (#753)
1 parent e29edf3 commit 113a57f

File tree

1 file changed

+114
-29
lines changed

1 file changed

+114
-29
lines changed

.github/workflows/packaging-pipeline.yml

+114-29
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,145 @@ on:
66
branches: [ master ]
77

88
jobs:
9-
# TODO(https://github.com/AcademySoftwareFoundation/OpenCue/issues/715) Add the other
10-
# packaging steps here. Things like building Docker images and extracting artifacts
11-
# will need to be generalized, but we need to test a few things in the master branch
12-
# first to make sure things are working as we expect.
13-
build_cuebot:
14-
name: Build Cuebot
9+
build_components:
1510
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
component: [cuebot, rqd]
14+
include:
15+
- component: cuebot
16+
NAME: Cuebot
17+
ARTIFACTS: cuebot-${BUILD_ID}-all.jar opencue-cuebot-${BUILD_ID}-1.noarch.rpm
18+
19+
- component: rqd
20+
NAME: RQD
21+
ARTIFACTS: rqd-${BUILD_ID}-all.tar.gz
22+
23+
- component: cuegui
24+
NAME: CueGUI
25+
ARTIFACTS: cuegui-${BUILD_ID}-all.tar.gz
26+
27+
- component: pycue
28+
NAME: PyCue
29+
ARTIFACTS: pycue-${BUILD_ID}-all.tar.gz
30+
31+
- component: pyoutline
32+
NAME: PyOutline
33+
ARTIFACTS: pyoutline-${BUILD_ID}-all.tar.gz
34+
35+
- component: cuesubmit
36+
NAME: CueSubmit
37+
ARTIFACTS: cuesubmit-${BUILD_ID}-all.tar.gz
38+
39+
- component: cueadmin
40+
NAME: CueAdmin
41+
ARTIFACTS: cueadmin-${BUILD_ID}-all.tar.gz
42+
43+
name: Build ${{ matrix.NAME }}
1644
steps:
17-
- uses: actions/checkout@v2
45+
- name: Checkout
46+
uses: actions/checkout@v2
1847
with:
1948
# Fetch all Git history, otherwise the current version number will
2049
# not be correctly calculated.
2150
fetch-depth: 0
51+
52+
- name: Configure AWS credentials
53+
uses: aws-actions/configure-aws-credentials@v1
54+
with:
55+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
56+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
57+
aws-region: ${{ secrets.S3_REGION }}
58+
role-to-assume: ${{ secrets.AWS_S3_ROLE }}
59+
role-duration-seconds: 1800
60+
2261
- name: Set build ID
2362
run: |
2463
set -e
2564
ci/generate_version_number.sh > VERSION
2665
echo "Build ID: $(cat ./VERSION)"
2766
echo "::set-env name=BUILD_ID::$(cat ./VERSION)"
28-
- uses: docker/build-push-action@v1
29-
name: Build Docker image
67+
68+
- name: Build Docker image
69+
uses: docker/build-push-action@v1
3070
with:
3171
username: ${{ secrets.DOCKER_USER }}
3272
password: ${{ secrets.DOCKER_PASS }}
33-
dockerfile: cuebot/Dockerfile
34-
repository: opencuebuild/cuebot
73+
dockerfile: ${{ matrix.component }}/Dockerfile
74+
repository: opencuebuild/${{ matrix.component }}
3575
tags: ${{ env.BUILD_ID }}
76+
3677
- name: Extract Artifacts
3778
run: |
3879
set -e
39-
image_name="opencuebuild/cuebot:${BUILD_ID}"
80+
image_name="opencuebuild/${{ matrix.component }}:${BUILD_ID}"
4081
container_id=$(docker create ${image_name})
41-
artifacts="/opt/opencue/cuebot-${BUILD_ID}-all.jar /opt/opencue/opencue-cuebot-${BUILD_ID}-1.noarch.rpm"
82+
artifacts="${{ matrix.ARTIFACTS }}"
4283
mkdir -p "${GITHUB_WORKSPACE}/artifacts/"
4384
for artifact in $artifacts; do
44-
docker cp ${container_id}:${artifact} "${GITHUB_WORKSPACE}/artifacts/"
85+
docker cp ${container_id}:/opt/opencue/${artifact} "${GITHUB_WORKSPACE}/artifacts/"
4586
done
4687
docker rm $container_id
47-
- uses: actions/upload-artifact@v2
48-
name: Upload JAR
88+
89+
- name: Upload Artifacts
90+
env:
91+
S3_BUCKET: ${{ secrets.S3_BUCKET }}
92+
run: |
93+
artifacts="${{ matrix.ARTIFACTS }}"
94+
for artifact in $artifacts; do
95+
aws s3 cp ${GITHUB_WORKSPACE}/artifacts/${artifact} s3://${S3_BUCKET}/opencue/${BUILD_ID}/
96+
done
97+
98+
create_other_artifacts:
99+
needs: build_components
100+
runs-on: ubuntu-latest
101+
name: Create Other Build Artifacts
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v2
49105
with:
50-
name: cuebot-jar
51-
path: ${{ github.workspace }}/artifacts/cuebot-*.jar
52-
- uses: actions/upload-artifact@v2
53-
name: Upload RPM
106+
# Fetch all Git history, otherwise the current version number will
107+
# not be correctly calculated.
108+
fetch-depth: 0
109+
110+
- name: Configure AWS credentials
111+
uses: aws-actions/configure-aws-credentials@v1
54112
with:
55-
name: cuebot-rpm
56-
path: ${{ github.workspace }}/artifacts/opencue-cuebot-*.rpm
57-
# TODO(https://github.com/AcademySoftwareFoundation/OpenCue/issues/715) Remove this step
58-
# in the next PR. This info will help us track this pipeline's artifacts as we attempt
59-
# to download them later, in the release pipeline. Once we know how the artifact tagging
60-
# works in the master branch it won't be needed anymore.
61-
- name: Print environment information
113+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
114+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
115+
aws-region: ${{ secrets.S3_REGION }}
116+
role-to-assume: ${{ secrets.AWS_S3_ROLE }}
117+
role-duration-seconds: 1800
118+
119+
- name: Set build ID
62120
run: |
63121
set -e
64-
echo "This SHA: ${{ github.sha }}"
65-
echo "This workflow run: ${{ github.run_id }}"
122+
ci/generate_version_number.sh > VERSION
123+
echo "Build ID: $(cat ./VERSION)"
124+
echo "::set-env name=BUILD_ID::$(cat ./VERSION)"
125+
126+
- name: Extract database schema
127+
run: |
128+
mkdir -p "${GITHUB_WORKSPACE}/artifacts/"
129+
ci/extract_schema.sh ${BUILD_ID} "${GITHUB_WORKSPACE}/artifacts/"
130+
131+
- name: Create build metadata
132+
run: |
133+
mkdir -p "${GITHUB_WORKSPACE}/artifacts/"
134+
echo "{\"git_commit\": \"$(BUILD_SOURCEVERSION)\"}" | tee "${GITHUB_WORKSPACE}/artifacts/build_metadata.json"
135+
136+
- name: Upload artifacts
137+
env:
138+
S3_BUCKET: ${{ secrets.S3_BUCKET }}
139+
run: |
140+
aws s3 cp LICENSE s3://${S3_BUCKET}/opencue/${BUILD_ID}/
141+
aws s3 cp VERSION s3://${S3_BUCKET}/opencue/${BUILD_ID}/
142+
aws s3 cp "${GITHUB_WORKSPACE}/artifacts/schema-${BUILD_ID}.sql" s3://${S3_BUCKET}/opencue/${BUILD_ID}/
143+
aws s3 cp "${GITHUB_WORKSPACE}/artifacts/demo_data-${BUILD_ID}.sql" s3://${S3_BUCKET}/opencue/${BUILD_ID}/
144+
aws s3 cp "${GITHUB_WORKSPACE}/artifacts/build_metadata.json" s3://${S3_BUCKET}/opencue/${BUILD_ID}/
145+
146+
- name: Display artifacts
147+
env:
148+
S3_BUCKET: ${{ secrets.S3_BUCKET }}
149+
run: |
150+
aws s3 ls s3://${S3_BUCKET}/opencue/${BUILD_ID}/

0 commit comments

Comments
 (0)