יצירת תהליך עבודה באמצעות מסוף Google Cloud
במדריך למתחילים הזה נסביר איך ליצור, לפרוס ולהפעיל את זרימת העבודה הראשונה באמצעות מסוף Google Cloud . תהליך העבודה לדוגמה שולח בקשה ל-API ציבורי ומחזיר את התגובה של ה-API.
לחצו על תראו לי איך כדי לקרוא הסבר מפורט על המשימה ישירות במסוף Google Cloud :
לפני שמתחילים
יכול להיות שהגבלות אבטחה שהוגדרו בארגון שלכם ימנעו מכם להשלים את השלבים הבאים. מידע לפתרון בעיות זמין במאמר פיתוח אפליקציות בסביבה מוגבלת. Google Cloud
- נכנסים לחשבון Google Cloud . אם אתם משתמשים חדשים ב- Google Cloud, צרו חשבון כדי שתוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Workflows API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Workflows API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.- מגדירים אימות:
-
מוודאים שיש לכם את תפקיד ה-IAM Create Service Accounts (
roles/iam.serviceAccountCreator) ואת תפקיד ה-IAM Project Admin (roles/resourcemanager.projectIamAdmin). איך מקצים תפקידים -
במסוף Google Cloud , נכנסים לדף יצירת חשבון שירות.
כניסה לדף Create service account - בוחרים את הפרויקט הרצוי.
-
כותבים שם בשדה Service account name. המסוף Google Cloud ממלא את השדה מזהה חשבון שירות בהתאם לשם הזה.
כותבים תיאור בשדה Service account description. לדוגמה:
Service account for quickstart. - לוחצים על Create and continue.
-
מקצים לחשבון השירות את התפקיד Logging > Logs Writer.
כדי להקצות את התפקיד, בוחרים באפשרות Logging > Logs Writer מהרשימה Select a role.
- לוחצים על Continue.
-
לוחצים על Done כדי לסיים ליצור את חשבון השירות.
-
מוודאים שיש לכם את תפקיד ה-IAM Create Service Accounts (
מידע נוסף על תפקידים והרשאות בחשבונות שירות זמין במאמר איך נותנים הרשאה לגישה למשאבי Google Cloud בתהליך עבודה.
התפקידים הנדרשים
כדי לקבל את ההרשאות שדרושות לביצוע ההפעלה המהירה הזו, צריך לבקש מהאדמין להקצות לכם את תפקידי ה-IAM הבאים בפרויקט:
- משתמש בחשבון שירות (
roles/iam.serviceAccountUser) - אדמין ב-Workflows (
roles/workflows.admin)
להסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.
יכול להיות שאפשר לקבל את ההרשאות הנדרשות גם באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש.
יצירה ופריסה של תהליך עבודה
נכנסים לדף Workflows במסוף Google Cloud :
בדף Workflows (תהליכי עבודה), לוחצים על Create (יצירה).
מזינים שם לתהליך העבודה החדש, למשל
myFirstWorkflow.בוחרים את האזור us-central1.
בקטע Service account, בוחרים את חשבון השירות שיצרתם קודם.
לוחצים על הבא.
בעורך תהליכי העבודה, מעתיקים ומדביקים את תהליך העבודה הבא:
YAML
JSON
אלא אם אתם מזינים מונח חיפוש משלכם, בתהליך העבודה הזה נעשה שימוש בGoogle Cloud מיקום שלכם כדי ליצור מונח חיפוש, שמועבר אל Wikipedia API. מוחזרת רשימה של מאמרי ויקיפדיה שקשורים לנושא.
לוחצים על פריסה.
ביצוע תהליך העבודה
אחרי שפורסים את תהליך העבודה בהצלחה, אפשר להריץ אותו בפעם הראשונה. אחרי פריסת תהליך העבודה, תועברו לדף פרטי תהליך העבודה.
בדף פרטי תהליך העבודה, לוחצים על הפעלה.
בדף Execute workflow (הפעלת תהליך עבודה), לוחצים על Execute (הפעלה).
בחלונית פלט מוצגות התוצאות של תהליך העבודה.
הפעלתם את זרימת העבודה הראשונה שלכם.
הסרת המשאבים
כדי לא לצבור חיובים לחשבון Google Cloud על המשאבים שבהם השתמשתם בדף הזה, פועלים לפי השלבים הבאים:
נכנסים לדף Workflows במסוף Google Cloud :
ברשימת תהליכי העבודה, לוחצים על תהליך עבודה כדי לעבור לדף פרטי תהליך העבודה.
לוחצים על מחיקה.
מקלידים את השם של תהליך העבודה ולוחצים על אישור.