def __call__(self): self._print_compliance() payload = { "evidence_type": self.evidence_type.value, "user_data": self.user_data.value, "contents": { "is_compliant": self.is_compliant.value == "TRUE", "url": self.ci_build_url.value, "description": self.description.value } } url = ApiSchema.url_for_artifact(self.host.value, self.merkelypipe, self.fingerprint.sha) http_put_payload(url, payload, self.api_token.value) return 'Putting', url, payload
def __call__(self): is_compliant, pull_requests = get_pull_request_for_current_commit(self.env) payload = { "evidence_type": self.evidence_type.value, "contents": { "is_compliant": is_compliant, "description": self.description.value, "url": self.ci_build_url.value, "source": pull_requests, } } url = ApiSchema.url_for_artifact(self.host.value, self.merkelypipe, self.fingerprint.sha) http_put_payload(url, payload, self.api_token.value) if not is_compliant: raise ChangeError(f"Artifact with sha {self.fingerprint.sha} is not compliant") return 'Putting', url, payload
def __call__(self): junit_results_dir = self.test_results_dir.value is_compliant, message = is_compliant_tests_directory(junit_results_dir) description = "JUnit results xml verified by merkely/change: " + message payload = { "evidence_type": self.evidence_type.value, "user_data": self.user_data.value, "contents": { "is_compliant": is_compliant, "url": self.ci_build_url.value, "description": description } } url = ApiSchema.url_for_artifact(self.host.value, self.merkelypipe, self.fingerprint.sha) http_put_payload(url, payload, self.api_token.value) return 'Putting', url, payload
def add_evidence(api_token, host, project_file_contents, sha256_digest, evidence): project_data = load_project_configuration(project_file_contents) url = ApiSchema.url_for_artifact(host, project_data, sha256_digest) http_put_payload(url, evidence, api_token)