Skip to content

Commit

Permalink
fixed flytectl error (flyteorg#317)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuvraj <[email protected]>
  • Loading branch information
yindia authored Jul 2, 2021
1 parent fbf28dd commit 48cb823
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 62 deletions.
56 changes: 24 additions & 32 deletions .github/workflows/release_examples.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: Serialize & Release Examples

on:
pull_request:
paths-ignore:
- 'cookbook/docs/**'
- 'cookbook/deployment/**'
create:
tags:
- v*

jobs:
serialize-example:
release-serialized-example:
name: Serialize
strategy:
matrix:
Expand All @@ -16,53 +20,41 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- uses: actions/cache@v1
with:
path: /tmp/release-snacks-${{ matrix.directory }}/
key: release-snacks-${{ matrix.directory }}-${{ github.sha }}
- name: Serialize Examples
env:
REGISTRY: "ghcr.io/flyteorg"
run: |
REGISTRY=ghcr.io/flyteorg VERSION=latest make -C cookbook/${{ matrix.directory }} serialize
- name: Cache Serialized protos
- name: Archive Serialized protos
env:
REGISTRY: "ghcr.io/flyteorg"
run: |
mkdir -p cookbook/release-snacks /tmp/release-snacks-${{ matrix.directory }}/
mkdir -p cookbook/release-snacks
make -C cookbook archive
cp -r cookbook/release-snacks/ /tmp/release-snacks-${{ matrix.directory }}/*
releaser:
name: Release example
- name: Run GoReleaser
if: github.event_name != 'pull_request'
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.FLYTE_BOT_PAT }}

release-manifest:
name: Release Manifest
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
needs: [ serialize-example ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- uses: actions/cache@v1
with:
path: /tmp/release-snacks-core/
key: release-snacks-core-${{ github.sha }}
- uses: actions/cache@v1
with:
path: /tmp/release-snacks-case_studies/
key: release-snacks-case_studies-${{ github.sha }}
- uses: actions/cache@v1
with:
path: /tmp/release-snacks-integrations/
key: release-snacks-integrations-${{ github.sha }}
- uses: actions/checkout@v2
with:
fetch-depth: "0"
ref: ${{ steps.bump-version.outputs.tag }}
- name: Copy artifacts
- name: Serialize Examples
env:
REGISTRY: "ghcr.io/flyteorg"
run: |
mkdir -p cookbook/release-snacks
cp -r /tmp/release-snacks-core/* cookbook/release-snacks/
cp -r /tmp/release-snacks-case_studies/* cookbook/release-snacks/
cp -r /tmp/release-snacks-integrations/* cookbook/release-snacks/
- name: Run GoReleaser
cp cookbook/flyte_tests_manifest.json cookbook/release-snacks/flyte_tests_manifest.json
- name: Release test manifest
uses: goreleaser/goreleaser-action@v2
with:
version: latest
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/sandbox_register.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
paths-ignore:
- 'cookbook/docs/**'
- 'cookbook/deployment/**'
branches:
- master

defaults:
run:
Expand All @@ -23,6 +21,6 @@ jobs:
fetch-depth: "0"
- uses: unionai/[email protected]
- name: setup sandbox
run: flytectl sandbox start --sourcesPath=$GITHUB_WORKSPACE
run: make setup
- name: fast register
run: REGISTRY=ghcr.io/flyteorg VERSION=latest make fast_register
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ _build/
.vscode/
*-out.html
*-out.ipynb
.python-version
.python-version
cookbook/release-snacks
3 changes: 1 addition & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ release:
name_template: "{{.ProjectName}} v{{.Version}}"
disable: false
extra_files:
- glob: ./cookbook/release-snacks/*.tgz
- glob: ./cookbook/flyte_tests_manifest.json
- glob: ./cookbook/release-snacks/*
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ endif
.PHONY: setup
setup:
$(call LOG,Starting Flyte sandbox)
flytectl sandbox start --sourcesPath=$(shell pwd)
flytectl sandbox start --source=$(shell pwd)

.PHONY: start
start: setup
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Here are the setup instructions to start contributing to `flytesnacks` repo:
4. Test your code!
* If the Python code can be run locally, just use `python <my file>` to run it.
* If the Python code has to be tested in a cluster:
* Install flytectl by running `brew install flyteorg/homebrew-tap/flytectl`. Learn more about install and configuration of [flytectl](https://docs.flyte.org/projects/flytectl/en/latest/index.html)
* Run the `make start` command in the root directory of the flytesnacks repo
* Visit https://localhost:30081 to view the Flyte console consisting of the examples present in flytesnacks/cookbook/core directory
* To fetch new dependencies and rebuild the image, run `make register`
Expand Down
5 changes: 1 addition & 4 deletions cookbook/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@ run-examples: ## Runs all examples

.PHONY: archive
archive: # archive directories (e.g. _pb_output/)
bash scripts/ci_helper.sh RELEASE
bash scripts/ci_helper.sh

.PHONY: register-workflow-ci
register-workflow-ci:
bash scripts/ci_helper.sh REGISTER
24 changes: 5 additions & 19 deletions cookbook/scripts/ci_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,8 @@

set -e

release_example() {
for row in $(cat flyte_tests_manifest.json | jq -c '.[]'); do
if [ -d "./$(echo ${row} | jq -r '.path')/_pb_output/" ]; then
tar -cvzf "./release-snacks/flytesnacks-$(echo ${row} | jq -r '.name').tgz" "./$(echo ${row} | jq -r '.path')/_pb_output/"
fi
done
}

register_example() {
for row in $(cat flyte_tests_manifest.json | jq -c '.[]'); do
flytectl register file "./release-snacks/flytesnacks-$(echo ${row} | jq -r '.name').tgz" -p flytesnacks -d development --archive
done
}

if [ "$1" == "RELEASE" ]; then
release_example
elif [ $1 == "REGISTER" ]; then
register_example
fi
for row in $(cat flyte_tests_manifest.json | jq -c '.[]'); do
if [ -d "./$(echo ${row} | jq -r '.path')/_pb_output/" ]; then
tar -cvzf "./release-snacks/flytesnacks-$(echo ${row} | jq -r '.name').tgz" "./$(echo ${row} | jq -r '.path')/_pb_output/"
fi
done

0 comments on commit 48cb823

Please sign in to comment.