Skip to content

Commit

Permalink
Enable use of pre-built helper images
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Harding <[email protected]>
  • Loading branch information
klutchell committed Feb 29, 2024
1 parent 0e794ff commit 19833ed
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 27 deletions.
13 changes: 1 addition & 12 deletions .github/workflows/dispatch-yocto-build-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
name: "Dispatch Yocto"
name: "Yocto"

on:
pull_request:
types: [opened, synchronize, closed]
branches:
- "main"
- "master"
pull_request_target:
types: [opened, synchronize, closed]
branches:
- "main"
- "master"

workflow_dispatch:
# you may only define up to 10 `inputs` for a `workflow_dispatch` event
inputs:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/flowzone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,22 @@ jobs:
docker_images: |
ghcr.io/balena-os/balena-yocto-scripts
bake_targets: yocto-build-env,balena-push-env,yocto-generate-ami-env

# depends on Flowzone having already published the helper images
yocto-build-deploy:
name: Yocto
uses: ./.github/workflows/yocto-build-deploy.yml
needs: flowzone
secrets: inherit
with:
# runs-on: '[ "ubuntu-latest" ]'
environment: staging
device-repo: balena-os/balena-generic
device-repo-ref: master
machine: generic-amd64
deploy-s3: false
deploy-hostapp: false
deploy-ami: false
sign-image: false
os-dev: false
deploy-esr: false
29 changes: 16 additions & 13 deletions .github/workflows/yocto-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ jobs:
BARYS_ARGUMENTS_VAR: ""
# URL for secure boot signing server API
SIGN_API_URL: ${{ vars.SIGN_API_URL || 'https://sign.balena-cloud.com' }}
HELPER_IMAGE_REPO: ghcr.io/balena-os/balena-yocto-scripts
BALENA_YOCTO_SCRIPTS_VERSION: build-${{ github.event.pull_request.head.sha || github.sha }}

outputs:
hostapp_path: ${{ steps.build.outputs.hostapp_path }}
Expand Down Expand Up @@ -278,9 +280,8 @@ jobs:
- name: Build
id: build
run: |
update-alternatives --set iptables /usr/sbin/iptables-legacy
mkdir -p "${YOCTO_CACHE_DIR}/$(whoami)" 2>/dev/null || true
./balena-yocto-scripts/build/balena-build.sh \
-d "${MACHINE}" \
-t "${{ secrets.BALENA_API_KEY }}" \
Expand Down Expand Up @@ -463,6 +464,8 @@ jobs:
S3_BUCKET: ${{ vars.S3_BUCKET || 'resin-production-img-cloudformation' }}
AWS_SUBNET_ID: ${{ vars.AWS_SUBNET || 'subnet-02d18a08ea4058574' }}
AWS_SECURITY_GROUP_ID: ${{ vars.AWS_SECURITY_GROUP || 'sg-057937f4d89d9d51c' }}
HELPER_IMAGE_REPO: ghcr.io/balena-os/balena-yocto-scripts
BALENA_YOCTO_SCRIPTS_VERSION: build-${{ github.event.pull_request.head.sha || github.sha }}

defaults:
run:
Expand Down Expand Up @@ -521,16 +524,16 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# TODO: use a prebuilt image for this
# https://github.com/docker/build-push-action
- name: Build helper image
id: helper-image
uses: docker/[email protected]
with:
context: "${{ github.workspace }}/balena-yocto-scripts/automation"
file: Dockerfile_yocto-build-env
target: yocto-generate-ami-env
push: false
# # TODO: use a prebuilt image for this
# # https://github.com/docker/build-push-action
# - name: Build helper image
# id: helper-image
# uses: docker/[email protected]
# with:
# context: "${{ github.workspace }}/balena-yocto-scripts/automation"
# file: Dockerfile_yocto-build-env
# target: yocto-generate-ami-env
# push: false

- name: Deploy AMI
env:
Expand Down Expand Up @@ -572,7 +575,7 @@ jobs:
-e AWS_SUBNET_ID \
-e AWS_SECURITY_GROUP_ID \
-w "${WORKSPACE}" \
"${{ steps.helper-image.outputs.imageid }}" /balena-generate-ami.sh
"${HELPER_IMAGE_REPO}:${BALENA_YOCTO_SCRIPTS_VERSION}-yocto-generate-ami-env" /balena-generate-ami.sh
balena-deploy:
name: HostApp Deploy
Expand Down
2 changes: 0 additions & 2 deletions automation/Dockerfile_yocto-build-env
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ RUN curl -sSL https://github.com/balena-io/balena-cli/releases/download/v$BALENA
mv balena-cli/* /usr/bin && \
rm -rf balena-cli.zip balena-cli

RUN update-alternatives --set iptables /usr/sbin/iptables-legacy

COPY include/balena-docker.inc /
COPY entry_scripts/prepare-and-start.sh /

Expand Down

0 comments on commit 19833ed

Please sign in to comment.