Loading gitlab_butler/butler.py +4 −4 Original line number Diff line number Diff line Loading @@ -445,8 +445,8 @@ class Butler: if self.verbose and self.debug: print(f'loaded cfg for project {project.path_with_namespace} = {cfg}') # # generate cutoff date updated_limit = datetime.today() - timedelta(days=cfg.pipelines.delete_older_than) # generate cutoff datetime, from current local day (must be offset-aware) updated_limit = datetime.now().astimezone().replace(hour=0, minute=0, second=0, microsecond=0) - timedelta(days=cfg.pipelines.delete_older_than) # count deletion attempts, and actual deletions pipelines_deletions_attempts = 0 Loading @@ -467,10 +467,10 @@ class Butler: break # if the pipeline has been updated after the cutoff date: keep and break loop if datetime.strptime(pipeline.updated_at, "%Y-%m-%dT%H:%M:%S.%fZ") >= updated_limit: if datetime.fromisoformat(pipeline.updated_at) >= updated_limit: if self.verbose and self.debug: print( f'Pipeline {pipeline.id} age is under limit ({datetime.strptime(pipeline.created_at, "%Y-%m-%dT%H:%M:%S.%fZ")} >= {updated_limit}), stopping') f'Pipeline {pipeline.id} age is under limit ({datetime.fromisoformat(pipeline.updated_at)} >= {updated_limit}), stopping') break # check pipeline source status Loading Loading
gitlab_butler/butler.py +4 −4 Original line number Diff line number Diff line Loading @@ -445,8 +445,8 @@ class Butler: if self.verbose and self.debug: print(f'loaded cfg for project {project.path_with_namespace} = {cfg}') # # generate cutoff date updated_limit = datetime.today() - timedelta(days=cfg.pipelines.delete_older_than) # generate cutoff datetime, from current local day (must be offset-aware) updated_limit = datetime.now().astimezone().replace(hour=0, minute=0, second=0, microsecond=0) - timedelta(days=cfg.pipelines.delete_older_than) # count deletion attempts, and actual deletions pipelines_deletions_attempts = 0 Loading @@ -467,10 +467,10 @@ class Butler: break # if the pipeline has been updated after the cutoff date: keep and break loop if datetime.strptime(pipeline.updated_at, "%Y-%m-%dT%H:%M:%S.%fZ") >= updated_limit: if datetime.fromisoformat(pipeline.updated_at) >= updated_limit: if self.verbose and self.debug: print( f'Pipeline {pipeline.id} age is under limit ({datetime.strptime(pipeline.created_at, "%Y-%m-%dT%H:%M:%S.%fZ")} >= {updated_limit}), stopping') f'Pipeline {pipeline.id} age is under limit ({datetime.fromisoformat(pipeline.updated_at)} >= {updated_limit}), stopping') break # check pipeline source status Loading