Skip to content

Commit

Permalink
Refactor makefile, add ubuntu1804 and fix label bug
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stolsma committed Feb 23, 2022
1 parent c3e7952 commit 91b21a3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
36 changes: 14 additions & 22 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
matrix:
# for OCI runner change to: runner: [ubuntu-latest, self-hosted]
runner: [ubuntu-latest]
os: [ubuntu2004, fedora33]
os: [ubuntu2004, ubuntu1804, fedora33]

steps:
- name: Checkout repository
Expand All @@ -45,13 +45,6 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# - name: Login to DockerHub
# if: github.event_name != 'pull_request'
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
Expand Down Expand Up @@ -86,21 +79,20 @@ jobs:
./ipdk install ${{ matrix.os }}
ipdk config IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/ipdk-${{ matrix.os }}-${{ steps.system.outputs.arch }}
- name: IPDK image build and push
if: github.event_name != 'pull_request'
run: |
ipdk build --no-cache \
--tags "${{ steps.image_meta.outputs.tags }}" \
--labels "${{ steps.image_meta.outputs.labels }}" \
--push
- name: IPDK image build and export
if: github.event_name == 'pull_request'
- name: IPDK image build and export or push
run: |
ipdk build --no-cache \
--tags "${{ steps.image_meta.outputs.tags }}" \
--labels "${{ steps.image_meta.outputs.labels }}" \
--export /tmp/${{ matrix.os }}-${{ steps.system.outputs.arch }}.tar
echo "{{ github.event_name }}"
if [ "{{ github.event_name }}" == "pull_request" ]; then
ipdk build --no-cache \
--tags "${{ steps.image_meta.outputs.tags }}" \
--labels "${{ steps.image_meta.outputs.labels }}" \
--export /tmp/${{ matrix.os }}-${{ steps.system.outputs.arch }}.tar
else
ipdk build --no-cache \
--tags "${{ steps.image_meta.outputs.tags }}" \
--labels "${{ steps.image_meta.outputs.labels }}" \
--push
fi
- name: Upload build artifact
if: github.event_name == 'pull_request'
Expand Down
8 changes: 7 additions & 1 deletion build/scripts/ipdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ build_image() {
if [[ "$LABELS" != "" ]] ; then
IFS="," read -r -a LABEL_LIST <<< "${LABELS}"
for i in "${LABEL_LIST[@]}" ; do
ARGS+=("--label" "${i}")
if [[ "$i" == *"="* ]]; then # solve the use of , in label string...
ARGS+=("--label" "${i}")
else
local LAST_INDEX=${#ARGS[@]}-1
local TEMP=${ARGS[${LAST_INDEX}]}
ARGS[${LAST_INDEX}]="${TEMP},${i}"
fi
done
fi

Expand Down

0 comments on commit 91b21a3

Please sign in to comment.