Skip to content

Commit 9ff4303

Browse files
committed
ci: Adding S3 storage
1 parent eab13f5 commit 9ff4303

File tree

3 files changed

+81
-7
lines changed

3 files changed

+81
-7
lines changed

.github/actions/bitbake-build/action.yml

+33-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
inputs:
2+
bitbake_buildname:
3+
default: 'build'
24
bitbake_prefix:
35
default: ''
6+
bitbake_machine:
7+
default: 'raspberrypi5'
48
bitbake_target:
59
default: 'core-image-weston-wpe'
610
bitbake_source:
@@ -15,6 +19,8 @@ runs:
1519
run: |
1620
echo "Environment:"
1721
echo "======================================================================"
22+
echo "BITBAKE_BUILDNAME=${{ inputs.bitbake_buildname }}"
23+
echo "BITBAKE_MACHINE=${{ inputs.bitbake_machine }}"
1824
echo "BITBAKE_PREFIX=${{ inputs.bitbake_prefix }}"
1925
echo "BITBAKE_SOURCE=${{ inputs.bitbake_source }}"
2026
echo "BITBAKE_TARGET=${{ inputs.bitbake_target }}"
@@ -24,18 +30,39 @@ runs:
2430
shell: bash
2531
run: |
2632
cd ~/yocto-meta-wpe-image-${{ inputs.repo_release }}
27-
rm -rf tmp
2833
ulimit -n 4096
29-
#source sources/meta-wpe-image/scripts/setup-environment ${{ inputs.bitbake_source }}
30-
source setup-environment ${{ inputs.bitbake_source }}
34+
source sources/meta-wpe-image/scripts/setup-environment ${{ inputs.bitbake_buildname}} ${{ inputs.bitbake_machine }} ${{ inputs.bitbake_source }}
35+
MAX_RETRIES=5
36+
export ${{ inputs.bitbake_prefix }}
37+
for i in $(seq 1 $MAX_RETRIES); do
38+
echo "Attempt $i to fetch sources for $IMAGE..."
39+
if bitbake ${{ inputs.bitbake_target }} --runall=fetch; then
40+
echo "All sources fetched successfully."
41+
break
42+
fi
43+
44+
if [ $i -lt $MAX_RETRIES ]; then
45+
echo "Retrying fetch process..."
46+
else
47+
echo "Max retries reached. Some sources may still be missing."
48+
fi
49+
done
3150
${{ inputs.bitbake_prefix }} bitbake ${{ inputs.bitbake_target }}
51+
- name: Generate timestamped prefix
52+
id: timestamp
53+
shell: bash
54+
run: |
55+
TIMESTAMP=$(date +"%Y%m%d%H%M")
56+
echo "prefix=${TIMESTAMP}" >> $GITHUB_OUTPUT
3257
- name: Artifacts
3358
if: always()
3459
shell: bash
35-
run: |
36-
ls -lh ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/*/tmp/deploy/images/*/
60+
run: |
61+
ls -lh ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/${{ inputs.bitbake_buildname }}/tmp/deploy/images/${{ inputs.bitbake_machine }}/
62+
PREFIX=${{ steps.timestamp.outputs.prefix }}
63+
s3cmd put --recursive ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/${{ inputs.bitbake_buildname }}/tmp/deploy/images/${{ inputs.bitbake_machine }} s3://yocto/${PREFIX}-${{ inputs.bitbake_buildname }}-${{ inputs.bitbake_target }}/
3764
- name: Clean the tmp dir
3865
if: always()
3966
shell: bash
4067
run: |
41-
rm -rf ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/*/tmp
68+
rm -rf ~/yocto-meta-wpe-image-${{ inputs.repo_release }}/builds/${{ inputs.bitbake_buildname }}/tmp
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
inputs:
2+
access_key:
3+
description: "S3 Access Key"
4+
required: true
5+
secret_key:
6+
description: "S3 Secret Key"
7+
required: true
8+
host_base:
9+
description: "S3 Host base"
10+
required: false
11+
default: "ams3.digitaloceanspaces.com"
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Configure s3cmd
17+
shell: bash
18+
run: |
19+
cat > ~/.s3cfg <<EOL
20+
[default]
21+
access_key = ${{ inputs.access_key }}
22+
secret_key = ${{ inputs.secret_key }}
23+
host_base = ${{ inputs.host_base }}
24+
host_bucket = %(bucket)s.${{ inputs.host_base }}
25+
use_https = True
26+
gpg_command = /usr/bin/gpg
27+
EOL
28+

.github/workflows/test-build.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,24 @@ jobs:
55
runs-on: [self-hosted, builder]
66
if: "!contains(github.event.head_commit.message, 'ci skip')"
77
steps:
8+
- name: test
9+
env:
10+
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
11+
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
12+
S3_HOST_BASE: ${{ secrets.S3_HOST_BASE }}
13+
run: |
14+
echo secrets.S3_HOST_BASE
15+
echo ${S3_HOST_BASE}
816
- uses: actions/checkout@v3
17+
- uses: ./.github/actions/s3-configure
18+
env:
19+
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
20+
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
21+
S3_HOST_BASE: ${{ secrets.S3_HOST_BASE }}
22+
with:
23+
access_key: ${S3_ACCESS_KEY}
24+
secret_key: ${S3_SECRET_KEY}
25+
host_base: ${S3_HOST_BASE}
926
- uses: ./.github/actions/bitbake-repo
1027
with:
1128
repo_release: 'scarthgap'
@@ -25,7 +42,9 @@ jobs:
2542
#- uses: actions/checkout@v3
2643
- uses: ./.github/actions/bitbake-build
2744
with:
28-
bitbake_source: 'raspberrypi3-mesa-wpe-${{ matrix.wpe_vers }} ${{ matrix.machine }} poky-wayland layers.raspberrypi conf.wpe-${{ matrix.wpe_vers }} --update-config'
45+
bitbake_buildname: wpe-${{ matrix.wpe_vers }}-${{ matrix.machine }}
46+
bitbake_machine: ${{ matrix.machine }}
47+
bitbake_source: 'poky-wayland layers.raspberrypi conf.wpe-${{ matrix.wpe_vers }} --update-config'
2948
repo_release: ${{ matrix.yocto_rel }}
3049

3150
# scarthgap-raspberrypi3-mesa-weston-wpe-nightly:

0 commit comments

Comments
 (0)