Skip to content

Commit

Permalink
T6732: build image workflow updated version to branch mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
kumvijaya authored Sep 26, 2024
1 parent 246c1b9 commit 414a488
Showing 1 changed file with 40 additions and 13 deletions.
53 changes: 40 additions & 13 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@ name: Build Image (VYOS)
on:
workflow_call:
inputs:
debian_mirror:
debian_mirror_url:
required: false
type: string
default: 'http://deb.debian.org/debian/'
debian_security_mirror:
debian_security_mirror_url:
required: false
type: string
default: ''
vyos_mirror:
vyos_mirror_base_url:
required: false
type: string
default: 'https://packages.vyos.net/repositories'
branch:
required: false
type: string
default: current
arch:
required: false
type: string
Expand All @@ -35,32 +31,63 @@ on:
required: false
type: string
default: 'generic'
upload_bucket_url:
required: false
type: string
default: ''
secrets:
token:
required: false

env:
BUILD_BY: ${{ inputs.build_by }}
DEBIAN_MIRROR: ${{ inputs.debian_mirror }}
VYOS_MIRROR: ${{ inputs.vyos_mirror }}/${{ inputs.branch }}/
DEBIAN_MIRROR: ${{ inputs.debian_mirror_url }}
VYOS_MIRROR_APT_KEY: https://packages.vyos.net/vyos_dev_public.key
LOCAL_GPG_KEY_PATH: /etc/apt/trusted.gpg.d/vyos_dev.gpg
RELEASE_FLAVOR: ${{ inputs.release_flavor }}
RELEASE_VERSION: ${{ inputs.release_version }}

jobs:
prepare-inputs:
runs-on: ubuntu-latest
outputs:
build_branch: ${{ steps.set_branch.outputs.build_branch }}
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set vyos-build branch based on version
id: set_branch
run: |
branch='main'
version="${{ inputs.release_version }}"
if [[ "$version" =~ ^1\.3\..* ]]; then
branch='equuleus'
elif [[ "$version" =~ ^1\.4\..* ]]; then
branch='sagitta'
elif [[ "$version" =~ ^1\.5\..* ]]; then
branch='circinus'
else
echo "ERROR - Unsupported version number $version" >&2
exit 1
fi
echo "build_branch=$branch" >> $GITHUB_OUTPUT

build-iso:
needs: prepare-inputs
runs-on: ubuntu-latest
container:
image: vyos/vyos-build:${{ inputs.branch }}
image: vyos/vyos-build:${{ needs.prepare-inputs.outputs.build_branch }}
options: --workdir /vyos --privileged

env:
BUILD_BRANCH: ${{ needs.prepare-inputs.outputs.build_branch }}
VYOS_MIRROR: ${{ inputs.vyos_mirror_base_url }}/${{ needs.prepare-inputs.outputs.build_branch }}/
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
repository: vyos/vyos-build # Use public repo
ref: ${{ inputs.branch }}
ref: ${{ env.BUILD_BRANCH }}

- name: Mark directory as safe
run: |
Expand All @@ -70,7 +97,7 @@ jobs:
- name: Setup env variables
run: |
set -eux
echo "BUILD_VERSION=${{ env.RELEASE_VERSION }}-${{ inputs.branch }}-$(date -u +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "BUILD_VERSION=${{ env.RELEASE_VERSION }}-${{ env.BUILD_BRANCH }}-$(date -u +%Y%m%d%H%M)" >> $GITHUB_ENV
- name: Get apt key
run: |
Expand Down

0 comments on commit 414a488

Please sign in to comment.