Skip to content

Commit

Permalink
Add bump git tags workflow (#4074)
Browse files Browse the repository at this point in the history
* Add bump git tags workflow

Signed-off-by: Eduardo Apolinario <[email protected]>

* Fix generation of next version

Signed-off-by: Eduardo Apolinario <[email protected]>

* Add docker-build back to integration tests dependencies

Signed-off-by: Eduardo Apolinario <[email protected]>

* Only run Component checks if there's any change to a component

Signed-off-by: Eduardo Apolinario <[email protected]>

* Add noop to trigger component checks

---------

Signed-off-by: Eduardo Apolinario <[email protected]>
Co-authored-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario and eapolinario authored Sep 26, 2023
1 parent b59c083 commit 8090b16
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 37 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/bump-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Bump git tags

on:
workflow_call:
outputs:
next_version:
description: "Tag name"
value: ${{ jobs.bump_version.outputs.next_version }}
secrets:
FLYTE_BOT_PAT:
required: true
jobs:
bump_version:
name: Bump Version
runs-on: ubuntu-latest
outputs:
next_version: ${{ steps.get_semver.outputs.next_version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
# Bump patch version
- uses: rickstaa/action-get-semver@v1
id: get_semver
with:
bump_level: "patch"
- name: Print current and next versions
run: |
echo "Current version: ${{ steps.get_semver.outputs.current_version }}"
echo "Next version: ${{ steps.get_semver.outputs.next_version }}"
# Generate all tags for all components
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.FLYTE_BOT_PAT }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${{ steps.get_semver.outputs.next_version }}`,
sha: context.sha
})
const components = [
"datacatalog",
"flyteadmin",
"flytecopilot",
"flyteplugins",
"flytepropeller",
"flytestdlib",
];
for (const c of components) {
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${c}/${{ steps.get_semver.outputs.next_version }}`,
sha: context.sha
})
}
82 changes: 50 additions & 32 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@ name: Components Checks

on:
pull_request:
paths:
- 'datacatalog/**'
- 'flyteadmin/**'
- 'flytecopilot/**'
- 'flyteidl/**'
- 'flyteplugins/**'
- 'flytepropeller/**'
- 'flytestdlib/**'
push:
branches:
- master
paths:
- 'datacatalog/**'
- 'flyteadmin/**'
- 'flytecopilot/**'
- 'flyteidl/**'
- 'flyteplugins/**'
- 'flytepropeller/**'
- 'flytestdlib/**'
env:
GO_VERSION: "1.19"
PRIORITIES: "P0"
Expand Down Expand Up @@ -117,15 +133,20 @@ jobs:
component: ${{ matrix.component }}
go-version: ${{ needs.unpack-envvars.outputs.go-version }}

# TODO(monorepo): enable bump_version
# bump_version:
# name: Bump Version
# if: ${{ github.event_name != 'pull_request' }}
# needs: [ endtoend, integration, lint, tests, generate ] # Only to ensure it can successfully build
# uses: flyteorg/flytetools/.github/workflows/bump_version.yml@master
# secrets:
# FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}
bump-tags:
name: Bump git tags
# TODO(monorepo): skip this if author is flyte-bot?
if: ${{ github.event_name != 'pull_request' }}
needs:
- integration
- lint
- unit-tests
- generate
uses: ./.github/workflows/bump-tags.yml
secrets:
FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}

# TODO(monorepo): we are not going to release any binary
# goreleaser:
# name: Goreleaser
# needs: [ bump_version ] # Only to ensure it can successfully build
Expand All @@ -135,27 +156,24 @@ jobs:
# secrets:
# FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}

# push_docker_image:
# name: Build & Push Image
# # TODO(monorepo): depend on bump_version
# # needs: [ bump_version ]
# strategy:
# fail-fast: false
# matrix:
# component:
# - datacatalog
# - flyteadmin
# - flytecopilot
# - flytepropeller
# - flytescheduler
# uses: ./.github/workflows/publish.yml
# with:
# version: "test-version-monorepo"
# component: ${{ matrix.component }}
# dockerfile: Dockerfile.${{ matrix.component }}
# # TODO(monorepo): set push to true once we depend on bump_version
# # push: true
# push: false
# secrets:
# FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}
# FLYTE_BOT_USERNAME: ${{ secrets.FLYTE_BOT_USERNAME }}
push_docker_image:
name: Build & Push Image
needs: [ bump-tags ]
strategy:
fail-fast: false
matrix:
component:
- datacatalog
- flyteadmin
- flytecopilot
- flytepropeller
- flytescheduler
uses: ./.github/workflows/publish.yml
with:
version: ${{ needs.bump-tags.outputs.next_version }}
component: ${{ matrix.component }}
dockerfile: Dockerfile.${{ matrix.component }}
push: true
secrets:
FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}
FLYTE_BOT_USERNAME: ${{ secrets.FLYTE_BOT_USERNAME }}
8 changes: 4 additions & 4 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Tag image to release version
run: |
for release in latest ${{ needs.bump-version.outputs.version }}; do
docker buildx imagetools create --tag "ghcr.io/flyteorg/flyte-binary-release:${release}" "ghcr.io/flyteorg/flyte-binary:sha-${{ github.sha }}"
docker buildx imagetools create --tag "ghcr.io/${{ github.repository_owner }}/flyte-binary-release:${release}" "ghcr.io/${{ github.repository_owner }}/flyte-binary:sha-${{ github.sha }}"
done
publish-flyte-component-image:
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
- name: Tag Image to release version
run: |
for release in latest ${{ needs.bump-version.outputs.version }}; do
docker buildx imagetools create --tag "ghcr.io/flyteorg/${{ matrix.component }}-release:${release}" "ghcr.io/flyteorg/${{ matrix.component }}:${{ steps.set_version.outputs.version }}"
docker buildx imagetools create --tag "ghcr.io/${{ github.repository_owner }}/${{ matrix.component }}-release:${release}" "ghcr.io/${{ github.repository_owner }}/${{ matrix.component }}:${{ steps.set_version.outputs.version }}"
done
helm-release:
Expand All @@ -116,7 +116,7 @@ jobs:
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
- name: Preprare Flyte Helm Release
- name: Prepare Flyte Helm Release
env:
VERSION: ${{ needs.bump-version.outputs.version }}
REPOSITORY: "https://flyteorg.github.io/flyte"
Expand All @@ -138,7 +138,7 @@ jobs:
with:
fetch-depth: "0"

- name: Preprare Flyte Release
- name: Prepare Flyte Release
env:
VERSION: ${{ needs.bump-version.outputs.version }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/helm-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
working-directory: charts
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
run:
helm push ${{ matrix.chart }}-*.tgz oci://ghcr.io/flyteorg/helm-charts
helm push ${{ matrix.chart }}-*.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts
1 change: 1 addition & 0 deletions datacatalog/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## _Read then delete this section_


_- Make sure to use a concise title for the pull-request._

_- Use #patch, #minor or #major in the pull-request title to bump the corresponding version. Otherwise, the patch version
Expand Down

0 comments on commit 8090b16

Please sign in to comment.