Open kokoichi206 opened 1 month ago
main: params: [event] steps: - init: assign: - project_id: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")} - bucket_name: ${event.data.bucket} - object_key: ${event.data.name} - job_name: extract-required-events - job_location: asia-northeast1 - extract_matches: assign: - matches: ${text.find_all_regex(object_key, "op=\\d+")} next: check_matches - check_matches: switch: - condition: ${len(matches) == 1} next: extract_op_id - condition: ${true} next: handle_error - extract_op_id: assign: - op_id_part_in_object_key: ${matches[0].match} - op_id: ${text.replace_all(op_id_part_in_object_key, "op=", "")} next: run_job - run_job: call: googleapis.run.v1.namespaces.jobs.run args: name: ${"namespaces/" + project_id + "/jobs/" + job_name} location: ${job_location} body: overrides: containerOverrides: args: - ${"--opID=" + op_id} result: job_execution - finish: return: ${job_execution} - handle_error: raise: "op_id not found"