Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #37 from DaPulse/update/ben/snowflake_app_name
Browse files Browse the repository at this point in the history
Update/ben/snowflake app name
  • Loading branch information
BenHababo authored Mar 21, 2024
2 parents 028fd07 + 961160f commit 7b3f39d
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 280 deletions.
71 changes: 0 additions & 71 deletions codefresh/CD/pipeline-spec.yml

This file was deleted.

144 changes: 0 additions & 144 deletions codefresh/CD/workflow.yml

This file was deleted.

3 changes: 3 additions & 0 deletions codefresh/CI/pipeline-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ kind: pipeline
metadata:
name: redash/CI
project: redash
labels:
tags:
- bi-engineering
spec:
triggers:
- name: staging
Expand Down
105 changes: 49 additions & 56 deletions codefresh/CI/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ stages:
- build
- wait-when-pr
- staging
# - wait-before-prod
# - production
# - after-deployment
- production
- after-deployment

steps:
clone:
Expand Down Expand Up @@ -89,7 +88,7 @@ steps:

approve:
title: 'Approve Before Staging'
stage: 'wait-when-pr'
stage: wait-when-pr
type: 'pending-approval'
timeout:
timeUnit: 'minutes'
Expand Down Expand Up @@ -120,66 +119,60 @@ steps:
title: Deploy staging
stage: staging
steps:
staging_use1:
title: Deploy staging use1
staging_argo:
title: Deploy staging using argocd
type: codefresh-run
arguments:
PIPELINE_ID: redash/CD
TRIGGER_ID: run-stage-use1
BRANCH: '${{CF_BRANCH}}'
SHA: '${{CF_REVISION}}'
PIPELINE_ID: infra-core/argocd
TRIGGER_ID: staging-bigbrain
BRANCH: master
ENABLE_NOTIFICATIONS: true
FOLLOW_LOGS: false
VARIABLE:
- REPO_NAME=${{CF_REPO_NAME}}
- REVISION=${{CF_REVISION}}
- BUILD_ID=${{CF_BUILD_ID}}
- CHECK_LOCK="false"
when:
condition:
any:
isMaster: "'${{CF_BRANCH}}' == 'master'"
isApproved: 'includes("${{STAGING_APPROVED}}", "{{STAGING_APPROVED}}") == false'

# approve_prod:
# type: pending-approval
# title: Approve Before Production
# description: Step description
# timeout:
# timeUnit: 'minutes'
# duration: 15
# finalState: denied
# fail_fast: false
# stage: wait-before-prod
# when:
# condition:
# all:
# isMaster: "'${{CF_BRANCH}}' == 'master'"
# myCondition: deploy_staging.result == 'success'
production:
type: parallel
title: Deploy production
stage: production
steps:
production_argo:
type: codefresh-run
title: 'Deploy production using ArgoCD'
arguments:
PIPELINE_ID: infra-core/argocd
TRIGGER_ID: production-bigbrain
BRANCH: master
ENABLE_NOTIFICATIONS: true
FOLLOW_LOGS: false
VARIABLE:
- REPO_NAME=${{CF_REPO_NAME}}
- REVISION=${{CF_REVISION}}
- BUILD_ID=${{CF_BUILD_ID}}
- CHECK_LOCK="false"
when:
condition:
all:
isMaster: "'${{CF_BRANCH}}' == 'master'"
myCondition: deploy_staging.result == 'success'


# production:
# type: parallel
# title: Deploy production
# stage: production
# steps:
# production_use1:
# title: Deploy production use1
# type: codefresh-run
# arguments:
# PIPELINE_ID: redash/CD
# TRIGGER_ID: run-prod-use1
# BRANCH: '${{CF_BRANCH}}'
# SHA: '${{CF_REVISION}}'
# ENABLE_NOTIFICATIONS: true
# FOLLOW_LOGS: false
# when:
# steps:
# - name: approve_prod
# 'on':
# - approved
# push_tag:
# title: Push latest docker tag
# type: push
# candidate: '${{build}}'
# tag: latest
# registry: 'aws-bi-use1'
# stage: after-deployment
# when:
# condition:
# all:
# myCondition: production.result == 'success'
push_tag:
title: Push latest docker tag
type: push
candidate: '${{build}}'
tag: latest
registry: 'aws-bi-use1'
stage: after-deployment
when:
condition:
all:
myCondition: production.result == 'success'
4 changes: 1 addition & 3 deletions redash/handlers/query_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ def run_query(
current_user.id,
current_user.is_api_user(),
metadata={
"Username": repr(current_user)
if current_user.is_api_user()
else current_user.email,
"Username": current_user.get_actual_user(),
"query_id": query_id,
},
)
Expand Down
3 changes: 2 additions & 1 deletion redash/models/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ def get_id(self):
).hexdigest()
return "{0}-{1}".format(self.id, identity)


def get_actual_user(self):
return repr(self) if self.is_api_user() else self.email
@generic_repr("id", "name", "type", "org_id")
class Group(db.Model, BelongsToOrgMixin):
DEFAULT_PERMISSIONS = [
Expand Down
2 changes: 2 additions & 0 deletions redash/query_runner/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
except ImportError:
enabled = False

from redash import __version__
from redash.query_runner import BaseQueryRunner, register
from redash.query_runner import (
TYPE_STRING,
Expand Down Expand Up @@ -129,6 +130,7 @@ def _get_connection(self):
account=account,
region=region,
host=host,
application="Redash/{} (Snowflake)".format(__version__.split("-")[0]),
)

return connection
Expand Down
Loading

0 comments on commit 7b3f39d

Please sign in to comment.