Skip to content

Commit cb2afc4

Browse files
committed
Refactor makefile, add ubuntu1804 and fix label bug
Add Ubuntu 18.04 as checked base image. Refactor build, push and export steps Fix label bug where label data with comma is truncated Signed-off-by: stolsma <[email protected]>
1 parent c3e7952 commit cb2afc4

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

.github/workflows/makefile.yml

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
matrix:
2828
# for OCI runner change to: runner: [ubuntu-latest, self-hosted]
2929
runner: [ubuntu-latest]
30-
os: [ubuntu2004, fedora33]
30+
os: [ubuntu2004, ubuntu1804, fedora33]
3131

3232
steps:
3333
- name: Checkout repository
@@ -45,13 +45,6 @@ jobs:
4545
- name: Set up Docker Buildx
4646
uses: docker/setup-buildx-action@v1
4747

48-
# - name: Login to DockerHub
49-
# if: github.event_name != 'pull_request'
50-
# uses: docker/login-action@v1
51-
# with:
52-
# username: ${{ secrets.DOCKERHUB_USERNAME }}
53-
# password: ${{ secrets.DOCKERHUB_TOKEN }}
54-
5548
- name: Login to GitHub Container Registry
5649
if: github.event_name != 'pull_request'
5750
uses: docker/login-action@v1
@@ -86,21 +79,19 @@ jobs:
8679
./ipdk install ${{ matrix.os }}
8780
ipdk config IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/ipdk-${{ matrix.os }}-${{ steps.system.outputs.arch }}
8881
89-
- name: IPDK image build and push
90-
if: github.event_name != 'pull_request'
91-
run: |
92-
ipdk build --no-cache \
93-
--tags "${{ steps.image_meta.outputs.tags }}" \
94-
--labels "${{ steps.image_meta.outputs.labels }}" \
95-
--push
96-
97-
- name: IPDK image build and export
98-
if: github.event_name == 'pull_request'
82+
- name: IPDK image build and export or push
9983
run: |
100-
ipdk build --no-cache \
101-
--tags "${{ steps.image_meta.outputs.tags }}" \
102-
--labels "${{ steps.image_meta.outputs.labels }}" \
103-
--export /tmp/${{ matrix.os }}-${{ steps.system.outputs.arch }}.tar
84+
if [ "${{ github.event_name }}" = "pull_request" ]; then
85+
ipdk build --no-cache \
86+
--tags "${{ steps.image_meta.outputs.tags }}" \
87+
--labels "${{ steps.image_meta.outputs.labels }}" \
88+
--export /tmp/${{ matrix.os }}-${{ steps.system.outputs.arch }}.tar
89+
else
90+
ipdk build --no-cache \
91+
--tags "${{ steps.image_meta.outputs.tags }}" \
92+
--labels "${{ steps.image_meta.outputs.labels }}" \
93+
--push
94+
fi
10495
10596
- name: Upload build artifact
10697
if: github.event_name == 'pull_request'

build/scripts/ipdk.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,13 @@ build_image() {
143143
if [[ "$LABELS" != "" ]] ; then
144144
IFS="," read -r -a LABEL_LIST <<< "${LABELS}"
145145
for i in "${LABEL_LIST[@]}" ; do
146-
ARGS+=("--label" "${i}")
146+
if [[ "$i" == *"="* ]]; then # solve the use of , in label string...
147+
ARGS+=("--label" "${i}")
148+
else
149+
local LAST_INDEX=${#ARGS[@]}-1
150+
local TEMP=${ARGS[${LAST_INDEX}]}
151+
ARGS[${LAST_INDEX}]="${TEMP},${i}"
152+
fi
147153
done
148154
fi
149155

0 commit comments

Comments
 (0)