Skip to content

Commit

Permalink
workflows: staging updates for 1.9 (#4876)
Browse files Browse the repository at this point in the history
* workflows: disable nightly build

Signed-off-by: Patrick Stephens <[email protected]>

* workflows: ensure exit success on release check

Signed-off-by: Patrick Stephens <[email protected]>

* workflows: add debug info

Signed-off-by: Patrick Stephens <[email protected]>

* workflows: add debug info

Signed-off-by: Patrick Stephens <[email protected]>

* workflows: add protection for only master tags

Signed-off-by: Patrick Stephens <[email protected]>

* workflows: get tag name

Signed-off-by: Patrick Stephens <[email protected]>

* workflows: fix staging image for multiarch

Signed-off-by: Patrick Stephens <[email protected]>
  • Loading branch information
patrick-stephens authored Feb 21, 2022
1 parent cd5446e commit 9b0165b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/staging-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Deploy to staging

on:
push:
branches:
- master
tags:
- '*'

Expand All @@ -13,13 +15,13 @@ on:
required: true
default: master
target:
description: Only build a specific target
description: Only build a specific target, intended for debug/test/quick builds only.
required: false
default: ""

# Run nightly build
schedule:
- cron: "0 6 * * *"
# Run nightly build - disable until after 1.9 release
# schedule:
# - cron: "0 6 * * *"

# We do not want a new staging build to run whilst we are releasing the current staging build.
# We also do not want multiples to run for the same version.
Expand All @@ -38,24 +40,26 @@ jobs:
version: ${{ steps.formatted_version.outputs.replaced }}
date: ${{ steps.date.outputs.date }}
steps:
# This step is to consolidate the three different triggers into a single "version"
# 1. If manual dispatch - use the version provided.
# 2. If cron/regular build - use master.
# 3. If tag trigger, use that tag.
- name: Get the version
id: get_version
# Use the input variable if defined, if not attempt to get a tag
run: |
VERSION="${INPUT_VERSION}"
if [ -z "${VERSION}" ]; then
if [ -z "${GITHUB_REF/refs\/tags\//}" ]; then
VERSION="${GITHUB_REF/refs\/tags\//}"
else
echo "Defaulting to master"
VERSION=master
fi
echo "Defaulting to master"
VERSION=master
fi
echo ::set-output name=VERSION::$VERSION
shell: bash
env:
INPUT_VERSION: ${{ github.event.inputs.version || '' }}
# Use the dispatch variable in preference, if empty use the context ref_name which should
# only ever be a tag or the master branch for cron builds.
INPUT_VERSION: ${{ github.event.inputs.version || github.ref_name }}

# String the 'v' prefix for tags.
- uses: frabert/[email protected]
id: formatted_version
with:
Expand All @@ -64,6 +68,7 @@ jobs:
replace-with: '$1'
flags: 'g'

# For cron builds, i.e. nightly, we provide date and time as extra parameter to distinguish them.
- name: Get current date
id: date
run: echo "::set-output name=date::$(date '+%Y-%m-%d-%H_%M_%S')"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/staging-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
cat latest-version.txt
STAGING_VERSION=$(cat latest-version.txt)
[[ "$STAGING_VERSION" != "$RELEASE_VERSION" ]] && echo "Latest version mismatch: $STAGING_VERSION != $RELEASE_VERSION" && exit 1
# Must end in something that exits 0
echo "Successfully confirmed version is as expected: $STAGING_VERSION"
shell: bash
env:
AWS_URL: https://${{ secrets.AWS_S3_BUCKET_STAGING }}.s3.amazonaws.com
Expand Down Expand Up @@ -94,7 +96,6 @@ jobs:
run: |
rm -f packaging/releases/*.repo
LATEST_VERSION=$(cat packaging/releases/latest-version.txt)
[[ "$LATEST_VERSION" != "$VERSION" ]] && echo "Latest version mismatch: $LATEST_VERSION != $VERSION"
packaging/update-repos.sh "$VERSION" packaging/releases/
rm -f packaging/releases/latest-version.txt
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/staging-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
image: ${{ github.repository }}/multiarch
image: ${{ github.repository }}/staging/multiarch
image-tag: latest
environment: staging
secrets:
Expand All @@ -77,7 +77,7 @@ jobs:
needs: [ staging-test-multiarch-images, staging-test-images-integration-gcp ]
uses: calyptia/fluent-bit-ci/.github/workflows/reusable-integration-test-gcp.yaml@main
with:
image_name: ghcr.io/${{ github.repository }}/multiarch
image_name: ghcr.io/${{ github.repository }}/staging/multiarch
image_tag: latest
secrets:
grafana_username: ${{ secrets.GRAFANA_USERNAME }}
Expand Down

0 comments on commit 9b0165b

Please sign in to comment.