Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add bitrise API #62

wants to merge 5 commits into from

Conversation

isabelrios
Copy link
Collaborator

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.

@isabelrios isabelrios requested a review from rpappalax February 13, 2025 16:46
url = self.__url
days_ago = 1
today = datetime.datetime.utcnow().date()
past_date = today - datetime.timedelta(days=days_ago)
Copy link
Collaborator Author

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.

@isabelrios isabelrios marked this pull request as ready for review March 28, 2025 14:45

def get_latest_build(self):
# Fetch latest triggered_at
latest_ts = self.db.session.query(func.max(ReportBitriseBuildsCount.triggered_at)).scalar() # noqa
Copy link
Collaborator Author

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):
Copy link
Collaborator Author

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):
Copy link
Collaborator Author

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):
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant