Skip to content

Commit

Permalink
Add GHA image build & push
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCreosote committed Jun 14, 2024
1 parent 807f1b4 commit 98e2a33
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build_push_cn_node_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build & Push StarRocks CN Image to GHCR

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review

push:
branches:
- main
- master
- develop

jobs:
trigger-build-push:
uses: ./.github/workflows/build_push_node_images.yaml
with:
node_name: cn
docker_file: './DockerFile_ComputeNode'
secrets: inherit
23 changes: 23 additions & 0 deletions .github/workflows/build_push_fe_node_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build & Push StarRocks FE Image to GHCR

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review

push:
branches:
- main
- master
- develop

jobs:
trigger-build-push:
uses: ./.github/workflows/build_push_node_images.yaml
with:
node_name: fe
docker_file: './DockerFile_FrontEnd'
secrets: inherit
50 changes: 50 additions & 0 deletions .github/workflows/build_push_node_images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build & Push StarRocks Node to GHCR

on:
workflow_call:
inputs:
node_name:
description: 'Name of the node to build and push, e.g. fe or cn'
required: true
type: string
docker_file:
description: 'Path to the docker file'
required: true
type: string

jobs:
build-push-tool-images:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub Repo
uses: actions/checkout@v4

- name: Get current date
id: date
run: echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: '${{ secrets.GHCR_USERNAME }}'
password: '${{ secrets.GHCR_TOKEN }}'

- name: Build and push node images
id: build-and-push
run: |
dockerfile=${{ inputs.docker_file }}
tag="ghcr.io/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}:${{inputs.node_name}}-pr-${{ github.event.number }}"
echo "Building and pushing ${{ inputs.node_name }} image..."
echo "tagging image with $tag"
docker buildx build --file "$dockerfile" --tag "$tag" \
--build-arg "BUILD_DATE=${{ steps.date.outputs.date }}" \
--build-arg "VCS_REF=${{ github.sha }}" \
--build-arg "BRANCH=${{ github.ref }}" \
--build-arg "TAG=${{ github.ref }}" \
--push .
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ In particular, see the *entrypoint.sh fiels for variables that are set to defaul
## Notes

* The dockerfiles use mostly default values, which is almost certainly bad.

## TODO

* Make GHA to push images from a release if we ever get to that point
* Dependabot / Trivy
* Tests...? Could start up the images and make sure they're contactable I guess
2 changes: 0 additions & 2 deletions scripts/fe-setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

# TODO: image buids

TF=/opt/starrocks/fe/conf/fe.conf

# NOTE: All FE nodes in a cluster must have the same http port:
Expand Down

0 comments on commit 98e2a33

Please sign in to comment.