-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add bitrise API #62
base: master
Are you sure you want to change the base?
Add bitrise API #62
Conversation
lib/bitrise_conn.py
Outdated
url = self.__url | ||
days_ago = 1 | ||
today = datetime.datetime.utcnow().date() | ||
past_date = today - datetime.timedelta(days=days_ago) |
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.
I would need to think how to narrow this down so that we are sure that we count the builds after sometime and right before the github action runs.
3b26740
to
d37cf43
Compare
|
||
def get_latest_build(self): | ||
# Fetch latest triggered_at | ||
latest_ts = self.db.session.query(func.max(ReportBitriseBuildsCount.triggered_at)).scalar() # noqa |
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.
So that I only add new builds, I get the latest triggered_at
value from database, then I do the query, get all builds after that date, that are not in-progress, that way I am sure I don't miss or duplicate any build.
Tested it a few times and is working.
api_bitrise.py
Outdated
super().__init__() | ||
self.db = DatabaseBitrise() | ||
|
||
def builds_daily_count(self): |
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.
Not sure we need the daily count, having all the builds info. I may remove this, not being used now
api_bitrise.py
Outdated
print(data) | ||
return data | ||
|
||
def report_bitrise_builds_count_insert(self, payload): |
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.
Not being used as this is the report for daily buidls that I may remove
api_bitrise.py
Outdated
super().__init__() | ||
self.db = Database() | ||
|
||
def parse_iso_timestamp(self, ts): |
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.
I will move this to a better place, just checking I can use it to get the data in the correct format
Initial PR to add Bitrise end point.
Only counting number of builds per day once we start running the script.
Table created and working on staging database.
I will add all the builds so that we have historical data at least starting on 2024.