-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve deploy process using custom github action #463
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9aa69c8
update dev variabe to test
amishas157 ce22673
Add if else condition
amishas157 8b93922
use different branch instead of master to test
amishas157 72a94df
use input name in tests
amishas157 0a3b05b
Update actual deploy code
amishas157 0eff767
revert the image
amishas157 25f47d4
remove prod workflow
amishas157 d4565a6
Merge branch 'master' into test-deploy-workflow
amishas157 8889417
Update .github/workflows/deploy.yml
amishas157 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,33 +13,6 @@ on: | |
- prod | ||
|
||
jobs: | ||
log: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Display Environment Name | ||
run: echo "Hello ${{ inputs.envName }}" | ||
|
||
pre-commit: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
- id: file_changes | ||
uses: trilom/[email protected] | ||
with: | ||
output: " " | ||
|
||
- uses: pre-commit/[email protected] | ||
env: | ||
extra_args: --color=always --files ${{ steps.file_changes.outputs.files}} | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
|
@@ -53,7 +26,7 @@ jobs: | |
|
||
- name: Install dependencies | ||
run: | | ||
cat airflow_variables_dev.json | sed -e s/\\/home\\/airflow\\/gcs\\/dags\\/// > airflow_variables_ci.json | ||
cat airflow_variables_${{ inputs.envName }}.json | sed -e s/\\/home\\/airflow\\/gcs\\/dags\\/// > airflow_variables_ci.json | ||
python -m pip install --upgrade pip | ||
pip install -r requirements-ci.txt | ||
|
||
|
@@ -78,6 +51,7 @@ jobs: | |
run: pytest dags/ | ||
|
||
deploy-to-dev: | ||
if: ${{ github.event.inputs.envName == 'dev' }} | ||
runs-on: ubuntu-latest | ||
needs: [tests] | ||
steps: | ||
|
@@ -116,3 +90,45 @@ jobs: | |
components install kubectl && gcloud composer environments run | ||
$COMPOSER_ENVIRONMENT --location $LOCATION variables import | ||
-- gcsfuse/actual_mount_path/variables.json | ||
|
||
deploy-to-prod: | ||
if: ${{ github.event.inputs.envName == 'prod' && github.ref == 'refs/heads/master' }} | ||
runs-on: ubuntu-latest | ||
needs: [tests] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install google-cloud-storage==2.1.0 | ||
|
||
- name: Authenticate to hubble GCP | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
credentials_json: "${{ secrets.CREDS_PROD_HUBBLE }}" | ||
|
||
- name: Upload files to prod GCS bucket | ||
run: python dags/stellar_etl_airflow/add_files_to_composer.py --bucket $BUCKET --env prod | ||
env: | ||
GOOGLE_CLOUD_PROJECT: hubble-261722 | ||
BUCKET: us-central1-hubble-14c4ca64-bucket | ||
|
||
- name: Update Airflow variables | ||
uses: actions-hub/gcloud@master | ||
env: | ||
PROJECT_ID: hubble-261722 | ||
APPLICATION_CREDENTIALS: "${{ secrets.CREDS_PROD_HUBBLE }}" | ||
COMPOSER_ENVIRONMENT: hubble | ||
LOCATION: us-central1 | ||
with: | ||
args: > | ||
components install kubectl && gcloud composer environments run | ||
$COMPOSER_ENVIRONMENT --location $LOCATION variables import | ||
-- gcsfuse/actual_mount_path/variables.json |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed anymore. We would require it only for merging