Skip to content

Commit 1e54cbc

Browse files
committed
add branch-specific nightly build
1 parent 0276573 commit 1e54cbc

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.github/workflows/nightlybuild.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@ jobs:
3333
OS_CLOUD: openstack
3434
CI_CLOUD: ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
3535
ARK_PASSWORD: ${{ secrets.ARK_PASSWORD }}
36+
# set the image version to empty string for cron else branch name suffix
37+
IMAGE_VER: ${{ (github.event_name == 'schedule' && '') || format('-{0}', github.ref_name) }}
3638

3739
steps:
3840
- uses: actions/checkout@v2
3941

4042
- name: Record settings for CI cloud
4143
run: |
4244
echo CI_CLOUD: ${{ env.CI_CLOUD }}
45+
echo IMAGE_VER: ${{ env.IMAGE_VER }}
4346
4447
- name: Setup ssh
4548
run: |
@@ -81,6 +84,7 @@ jobs:
8184
-var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
8285
-var "source_image_name=${{ matrix.build.source_image_name }}" \
8386
-var "image_name=rocky-latest-${{ matrix.build.label }}" \
87+
-var "image_name_version=${{ env.IMAGE_VER }}" \
8488
-var "inventory_groups=update" \
8589
openstack.pkr.hcl
8690
@@ -120,6 +124,8 @@ jobs:
120124
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.build.label }}-${{ matrix.target_cloud }}
121125
cancel-in-progress: true
122126
runs-on: ubuntu-22.04
127+
# Don't sync manually-triggered image builds
128+
if: ${{ github.event_name == 'schedule' }}
123129
strategy:
124130
fail-fast: false
125131
matrix:

packer/openstack.pkr.hcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ data "git-commit" "cwd-head" { }
2323
locals {
2424
git_commit = data.git-commit.cwd-head.hash
2525
timestamp = formatdate("YYMMDD-hhmm", timestamp())
26-
image_name_version = var.image_name_version == "auto" ? "-${local.timestamp}-${substr(local.git_commit, 0, 8)}" : var.image_name_version
26+
image_name_version = var.image_name_version == "auto" ? "-${local.timestamp}-${substr(local.git_commit, 0, 8)}" : replace(var.image_name_version, "/", "")
2727
}
2828

2929
# Path pointing to root of repository - automatically set by environment variable PKR_VAR_repo_root
@@ -146,7 +146,7 @@ variable "image_name" {
146146

147147
variable "image_name_version" {
148148
type = string
149-
description = "Suffix for image name giving version. Default of 'auto' appends timestamp + short commit"
149+
description = "Suffix for image name giving version. Default of 'auto' appends timestamp + short commit. Note / characters are stripped to allow using branch names"
150150
default = "auto"
151151
}
152152

0 commit comments

Comments
 (0)