Skip to content

Parsing date-time string for pipeline.completed_on failing due to strftime issue. #1372

Open
@CrispyCB

Description

@CrispyCB
Traceback (most recent call last):
  File "/opt/atlassian/pipelines/agent/build/pipelineAuditHandler.py", line 84, in <module>
    audit_repositories(selectquote, fintech_repo_list)
  File "/opt/atlassian/pipelines/agent/build/pipelineAuditHandler.py", line 61, in audit_repositories
Repository found: fintech-ui
    f"{nickname} ran a {state} pipeline against {pipeline.data['target']['ref_name']} in {repo.name} on {pipeline.completed_on}.\n"
  File "/usr/local/lib/python3.10/site-packages/atlassian/bitbucket/cloud/repositories/pipelines.py", line 139, in completed_on
    return self.get_time("completed_on")
  File "/usr/local/lib/python3.10/site-packages/atlassian/bitbucket/base.py", line 167, in get_time
    value = datetime.strptime(value_str, self.CONF_TIMEFORMAT)
  File "/usr/local/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.10/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '2024-04-10T20:16:48.914706353Z' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'

Attempting to parse pipeline.completed_on (or any date-time string, I assume) fails with the above error.

Steps to recreate:

  1. Get a single Atlassian pipeline run.
  2. Print its completed_on value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions