تعريف jobs.job

الوظيفة هي مجموعة من الخطوات التي يتم تشغيلها بواسطة عامل أو على خادم.

jobs:
- job: string # Required as first property. ID of the job.
  displayName: string # Human-readable name for the job.
  dependsOn: string | [ string ] # Any jobs which must complete before this one.
  condition: string # Evaluate this condition expression to determine whether to run this job.
  continueOnError: string # Continue running even on failure?
  timeoutInMinutes: string # Time to wait for this job to complete before the server kills it.
  cancelTimeoutInMinutes: string # Time to wait for the job to cancel before forcibly terminating it.
  variables: variables | [ variable ] # Job-specific variables.
  strategy: strategy # Execution strategy for this job.
  pool: string | pool # Pool where this job will run.
  container: string | container # Container resource name.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
  workspace: # Workspace options on the agent.
    clean: string # Which parts of the workspace should be scorched before fetching.
  uses: # Any resources required by this job that are not already referenced.
    repositories: [ string ] # Repository references.
    pools: [ string ] # Pool references.
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
  templateContext: # Job related information passed from a pipeline when extending a template.
jobs:
- job: string # Required as first property. ID of the job.
  displayName: string # Human-readable name for the job.
  dependsOn: string | [ string ] # Any jobs which must complete before this one.
  condition: string # Evaluate this condition expression to determine whether to run this job.
  continueOnError: string # Continue running even on failure?
  timeoutInMinutes: string # Time to wait for this job to complete before the server kills it.
  cancelTimeoutInMinutes: string # Time to wait for the job to cancel before forcibly terminating it.
  variables: variables | [ variable ] # Job-specific variables.
  strategy: strategy # Execution strategy for this job.
  pool: string | pool # Pool where this job will run.
  container: string | container # Container resource name.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
  workspace: # Workspace options on the agent.
    clean: string # Which parts of the workspace should be scorched before fetching.
  uses: # Any resources required by this job that are not already referenced.
    repositories: [ string ] # Repository references.
    pools: [ string ] # Pool references.
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
jobs:
- job: string # Required as first property. ID of the job.
  displayName: string # Human-readable name for the job.
  dependsOn: string | [ string ] # Any jobs which must complete before this one.
  condition: string # Evaluate this condition expression to determine whether to run this job.
  continueOnError: string # Continue running even on failure?
  timeoutInMinutes: string # Time to wait for this job to complete before the server kills it.
  cancelTimeoutInMinutes: string # Time to wait for the job to cancel before forcibly terminating it.
  variables: variables | [ variable ] # Job-specific variables.
  strategy: strategy # Execution strategy for this job.
  pool: string | pool # Pool where this job will run.
  container: string | container # Container resource name.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
  workspace: # Workspace options on the agent.
    clean: string # Which parts of the workspace should be scorched before fetching.
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
jobs:
- job: string # Required as first property. ID of the job.
  displayName: string # Human-readable name for the job.
  dependsOn: string | [ string ] # Any jobs which must complete before this one.
  condition: string # Evaluate this condition expression to determine whether to run this job.
  continueOnError: string # Continue running even on failure?
  timeoutInMinutes: string # Time to wait for this job to complete before the server kills it.
  cancelTimeoutInMinutes: string # Time to wait for the job to cancel before forcibly terminating it.
  variables: variables | [ variable ] # Job-specific variables.
  strategy: strategy # Execution strategy for this job.
  pool: string | pool # Pool where this job will run.
  container: string | container # Container resource name.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
  workspace: # Workspace options on the agent.
    clean: string # Scorch the repo before fetching?
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | publish | template ] # A list of steps to run.
jobs:
- job: string # Required as first property. ID of the job.
  displayName: string # Human-readable name for the job.
  dependsOn: string | [ string ] # Any jobs which must complete before this one.
  condition: string # Evaluate this condition expression to determine whether to run this job.
  continueOnError: string # Continue running even on failure?
  timeoutInMinutes: string # Time to wait for this job to complete before the server kills it.
  cancelTimeoutInMinutes: string # Time to wait for the job to cancel before forcibly terminating it.
  variables: variables | [ variable ] # Job-specific variables.
  strategy: strategy # Execution strategy for this job.
  pool: string | pool # Pool where this job will run.
  services: # Container resources to run as a service container.
    string: string # Name/value pairs
  workspace: # Workspace options on the agent.
    clean: string # Scorch the repo before fetching?
  steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | publish | template ] # A list of steps to run.

التعريفات التي تشير إلى هذا التعريف: الوظائف

الخصائص

job سلسله. مطلوب كخاصية أولى.
معرف الوظيفة. القيم المقبولة: قد تحتوي الأسماء الصالحة فقط على أحرف أبجدية رقمية و'_' وقد لا تبدأ برقم.

displayName سلسله.
اسم يمكن للبشر قراءته للمهمة.

dependsOn سلسلة | قائمة السلسلة.
أي وظائف يجب أن تكتمل قبل هذه المهمة.

condition سلسله.
قم بتقييم تعبير الشرط هذا لتحديد ما إذا كنت تريد تشغيل هذه المهمة.

continueOnError سلسله.
هل تستمر في التشغيل حتى عند الفشل؟

timeoutInMinutes سلسله.
حان الوقت لانتظار اكتمال هذه المهمة قبل أن يقتلها الخادم.

cancelTimeoutInMinutes سلسله.
حان الوقت لانتظار إلغاء المهمة قبل إنهائها قسرا.

variablesالمتغيرات.
المتغيرات الخاصة بالوظيفة.

strategyjobs.job.strategy.
استراتيجية التنفيذ لهذه الوظيفة.

poolتجمع.
تجمع حيث سيتم تشغيل هذه المهمة.

containerjobs.job.container.
اسم مورد الحاوية.

services قاموس السلسلة.
موارد الحاوية لتشغيلها كحاوية خدمة.

workspaceمساحة العمل.
خيارات مساحة العمل على العامل. لمزيد من المعلومات حول مساحات العمل، بما في ذلك الخيارات النظيفة، راجع موضوع مساحة العمل في الوظائف.

usesjobs.job.uses.
أي موارد مطلوبة من قبل هذه الوظيفة لم تتم الإشارة إليها بالفعل. لمزيد من المعلومات حول uses، راجع تحديد نطاق تخويل الوظيفة إلى مستودعات Azure DevOps المشار إليها.

stepsالخطوات.
قائمة بالخطوات التي يجب تشغيلها.

templateContext templateContext.
المعلومات المتعلقة بالمهمة التي تم تمريرها من البنية الأساسية لبرنامج ربط العمليات التجارية عند توسيع قالب. راجع الملاحظات لمزيد من المعلومات. لمزيد من المعلومات حول templateContext، راجع يمكن الآن تمرير قوالب مسارات YAML الموسعة معلومات السياق للمراحل والوظائف وعمليات التوزيعوالقوالب - استخدم templateContext لتمرير الخصائص إلى القوالب.

الملاحظات

يتم تعيين الإعداد الافتراضي timeoutInMinutes إلى 60 دقيقة. لمزيد من المعلومات، راجع المهلات.

يمكن تشغيل الوظائف بشكل مشروط وقد تعتمد على الوظائف السابقة.

ملاحظة

إذا كان لديك مرحلة واحدة ووظيفة واحدة فقط، يمكنك استخدام بناء جملة وظيفة واحدة كطريقة أقصر لوصف خطوات التشغيل.

أمثلة

jobs:
- job: MyJob
  displayName: My First Job
  continueOnError: true
  workspace:
    clean: outputs
  steps:
  - script: echo My first job

راجع أيضًا