Skip to content

Commit

Permalink
Improve reusability and test
Browse files Browse the repository at this point in the history
- tester can validate HURL request now thanks to the is_for_test filtering variable
- secrets are usable in the base workflow
  • Loading branch information
Soubinan committed Mar 9, 2024
1 parent 41a141a commit 1b98e57
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/publish_build.hurl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Authorization: Bearer {{token}}

```graphql
mutation CreateApplication {
createApplication(data: {name: "{{app_name}}", source: "{{source}}"}) {
createApplication(data: {name: "{{app_name}}", source: "{{source}}", isForTest: {{is_for_test}}}) {
id
}
}
Expand Down Expand Up @@ -40,7 +40,7 @@ Authorization: Bearer {{token}}

```graphql
mutation PublishBuild {
publishBuild(where: {version: "{{app_name}}-{{app_version}}"}) {
publishBuild(where: {buildId: "{{build_id}}"}) {
id
}
}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-homarr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ jobs:
architecture: ${{matrix.architectures}}
branch_name: ${{github.event.pull_request.base.ref}}
is_merged: ${{github.event.pull_request.merged}}
secrets: inherit
3 changes: 2 additions & 1 deletion .github/workflows/build-tester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ jobs:
distribution: debian
release: bookworm
architecture: ${{matrix.architectures}}
branch_name: dev
branch_name: test
is_merged: false
secrets: inherit
20 changes: 15 additions & 5 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ on:
is_merged:
required: true
type: boolean
secrets:
HOMELAB_LXC_EP:
required: true
HOMELAB_LXC_TOKEN:
required: true
RCLONE_CONFIG:
required: true
RCLONE_CONFIG_PASS:
required: true

jobs:
image-build:
Expand Down Expand Up @@ -60,7 +69,9 @@ jobs:
- name: Publish Image files
if: github.event_name == 'schedule' || (inputs.branch_name == 'main' && inputs.is_merged == true)
run: |
echo "$RCLONE_CONFIG" > /tmp/rclone.conf
cat << EOF > /tmp/rclone.conf
$RCLONE_CONFIG
EOF
echo
rclone copy ./${{inputs.app_name}}-${{inputs.app_version}}-${{inputs.architecture}}-root.tar.xz cloudflare:lxc-images --config /tmp/rclone.conf
rclone copy ./${{inputs.app_name}}-${{inputs.app_version}}-${{inputs.architecture}}-meta.tar.xz cloudflare:lxc-images --config /tmp/rclone.conf
Expand All @@ -71,14 +82,13 @@ jobs:
RCLONE_CONFIG_PASS: ${{secrets.RCLONE_CONFIG_PASS}}

- name: Publish build info
if: github.event_name == 'schedule' || (inputs.branch_name == 'main' && inputs.is_merged == true)
if: inputs.branch_name == 'test' || github.event_name == 'schedule' || (inputs.branch_name == 'main' && inputs.is_merged == true)
run: |
hurl --variable endpoint_url=$HOMELAB_LXC_EP --variable token=$HOMELAB_LXC_TOKEN \
hurl --variable endpoint_url=$HOMELAB_LXC_EP --variable token=$HOMELAB_LXC_TOKEN \
hurl -v --variable endpoint_url=$HOMELAB_LXC_EP --variable token=$HOMELAB_LXC_TOKEN \
--variable app_name=${{inputs.app_name}} --variable app_version=${{inputs.app_version}} \
--variable arch=${{inputs.architecture}} --variable dist=${{inputs.distribution}} \
--variable dist_release=${{inputs.release}} --variable build_id=${{inputs.app_name}}-${{inputs.app_version}}-${{inputs.architecture}}.tar.xz\
--variable size=$ARTIFACT_SIZE --variable source=${{inputs.project_source}}\
--variable size=$ARTIFACT_SIZE --variable source=${{inputs.project_source}} --variable is_for_test=${{inputs.branch_name == 'test'}}\
.github/publish_build.hurl
echo
echo 'LXC build details published successfully !'
Expand Down

0 comments on commit 1b98e57

Please sign in to comment.