Adding osc local build option in the workflow
All checks were successful
OSC Pull Custom Image Demo / opensuse osc custom container checkout test (push) Successful in 20s

Signed-off-by: Alex Lau (AvengerMoJo) <alau@suse.com>
This commit is contained in:
Alex Lau 2023-11-20 14:27:07 +08:00
parent 574d615ec5
commit 4deaf112fa
6 changed files with 30 additions and 16 deletions

View File

@ -8,12 +8,21 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: opensuse osc custom container checkout test name: opensuse osc custom container checkout test
steps: steps:
- name: Build action step - name: Get OBS Buildlog step
uses: https://src.opensuse.org/alexlau/bc@v4 uses: https://src.opensuse.org/alexlau/bc@v4
with: with:
osc_user: 'alexlau' osc_user: 'alexlau'
osc_path: 'home:alexlau:branches:Base:System' osc_path: 'home:alexlau:branches:Base:System'
osc_package: 'bc' osc_package: 'bc'
osc_action: 'buildlog'
env: # Or as an environment variable
osc_pass: ${{ secrets.OSCPASS }}
- name: Run a local build step
uses: https://src.opensuse.org/alexlau/bc@v4
with:
osc_user: 'alexlau'
osc_path: 'home:alexlau:branches:Base:System'
osc_package: 'bc'
osc_action: 'build'
env: # Or as an environment variable env: # Or as an environment variable
osc_pass: ${{ secrets.OSCPASS }} osc_pass: ${{ secrets.OSCPASS }}
id: osc-demo

View File

@ -16,3 +16,4 @@ runs:
- ${{ inputs.osc_user}} - ${{ inputs.osc_user}}
- ${{ inputs.osc_path}} - ${{ inputs.osc_path}}
- ${{ inputs.osc_package}} - ${{ inputs.osc_package}}
- ${{ inputs.osc_action}}

View File

@ -1,10 +1,5 @@
#!/bin/sh -l #!/bin/sh -l
# echo $1 $2 $3
# echo "${osc_user} ${osc_path} ${osc_package}"
# echo "${INPUT_OSC_USER} ${INPUT_OSC_PATH} ${INPUT_OSC_PACKAGE}"
# osc checkout $INPUT_OSC_PATH $INPUT_OSC_PACKAGE
cd "${INPUT_OSC_PATH}/${INPUT_OSC_PACKAGE}" cd "${INPUT_OSC_PATH}/${INPUT_OSC_PACKAGE}"
osc buildlog openSUSE_Factory x86_64 osc buildlog openSUSE_Factory x86_64
echo "Getting binaries from the obs"; echo "Getting binaries from the obs";

View File

@ -1,10 +1,5 @@
#!/usr/bin/expect -f #!/usr/bin/expect -f
# echo $1 $2 $3
# echo "${osc_user} ${osc_path} ${osc_package}"
# echo "${INPUT_OSC_USER} ${INPUT_OSC_PATH} ${INPUT_OSC_PACKAGE}"
set timeout -1 set timeout -1
spawn osc checkout "$env(INPUT_OSC_PATH)" "$env(INPUT_OSC_PACKAGE)" spawn osc checkout "$env(INPUT_OSC_PATH)" "$env(INPUT_OSC_PACKAGE)"
expect { expect {
@ -17,4 +12,3 @@ expect {
send "osc buildlog openSUSE_Factory x86_64\r"; send "osc buildlog openSUSE_Factory x86_64\r";
exp_continue } exp_continue }
} }

7
osc_local_build.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh -l
cd "${INPUT_OSC_PATH}/${INPUT_OSC_PACKAGE}"
echo "Building binaries in the local container";
osc build openSUSE_Factory x86_64

View File

@ -1,9 +1,17 @@
#!/bin/sh -l #!/bin/sh -l
echo $1 $2 $3 echo $1 $2 $3 $4
echo "${osc_user} ${osc_path} ${osc_package}" echo "${osc_user} ${osc_path} ${osc_package}"
echo "${INPUT_OSC_USER} ${INPUT_OSC_PATH} ${INPUT_OSC_PACKAGE}" echo "${INPUT_OSC_USER} ${INPUT_OSC_PATH} ${INPUT_OSC_PACKAGE}"
# osc checkout $INPUT_OSC_PATH $INPUT_OSC_PACKAGE # osc checkout $INPUT_OSC_PATH $INPUT_OSC_PACKAGE
# osc buildlog openSUSE_Factory x86_64 # osc buildlog openSUSE_Factory x86_64
/usr/bin/expect /osc_checkout if [ "$4" = "buildlog" ]; then
/osc_buildlog.sh echo "OBS buildlog ..."
/usr/bin/expect /osc_checkout
/osc_buildlog.sh
elif [ "$4" = "build" ]; then
echo "Triggering local build..."
/usr/bin/expect /osc_checkout
/osc_local_build.sh
fi