0%
التطوير على Azure

التطوير على Azure

اكتشف خدمات التطوير في Azure من خلال أمثلة عملية.

I

InSkillCoach

· دقيقة

التطوير على Azure

اكتشف أهم خدمات التطوير في Azure من خلال أمثلة عملية.

Azure DevOps

Azure DevOps منصة متكاملة لتطوير البرمجيات.

إعداد مشروع

from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication

# إنشاء الاتصال
credentials = BasicAuthentication('', '<pat_token>')
connection = Connection(base_url='<organization_url>', creds=credentials)
client = connection.clients.get_core_client()

# إنشاء مشروع
project = {
    "name": "mon-projet",
    "description": "Description du projet",
    "capabilities": {
        "versioncontrol": {
            "sourceControlType": "Git"
        },
        "processTemplate": {
            "templateTypeId": "6b724908-ef14-45cf-84f8-768b5384da45"
        }
    }
}

# إنشاء المشروع
client.create_project(project)

إعداد خط CI/CD

trigger:
  branches:
    include:
    - main
  paths:
    include:
    - src/*
    - tests/*

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
  inputs:
    versionSpec: '3.9'
    addToPath: true

- script: |
    python -m pip install --upgrade pip
    pip install -r requirements.txt
    python -m pytest tests/
  displayName: 'Install dependencies and run tests'

- task: AzureWebApp@1
  inputs:
    azureSubscription: 'mon-connection'
    appName: 'mon-app'
    package: '$(System.DefaultWorkingDirectory)/src'

Azure Repos

Azure Repos لإدارة الشيفرة المصدرية.

إنشاء مستودع

from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication

# إنشاء الاتصال
credentials = BasicAuthentication('', '<pat_token>')
connection = Connection(base_url='<organization_url>', creds=credentials)
client = connection.clients.get_git_client()

# إنشاء مستودع
repository = {
    "name": "mon-repo",
    "project": {
        "id": "<project_id>"
    }
}

# إنشاء المستودع
client.create_repository(repository)

إدارة الفروع

# إنشاء فرع
branch = {
    "name": "feature/nouvelle-fonctionnalite",
    "oldObjectId": "<commit_id>",
    "newObjectId": "<new_commit_id>"
}

# إنشاء الفرع
client.create_ref(
    repository_id="<repo_id>",
    ref=branch
)

# إنشاء طلب سحب (pull request)
pull_request = {
    "sourceRefName": "refs/heads/feature/nouvelle-fonctionnalite",
    "targetRefName": "refs/heads/main",
    "title": "Nouvelle fonctionnalité",
    "description": "Description des changements"
}

# إنشاء طلب السحب
client.create_pull_request(
    repository_id="<repo_id>",
    pull_request=pull_request
)

Azure Artifacts

Azure Artifacts لإدارة الحزم.

نشر حزمة

from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication

# إنشاء الاتصال
credentials = BasicAuthentication('', '<pat_token>')
connection = Connection(base_url='<organization_url>', creds=credentials)
client = connection.clients.get_packaging_client()

# إنشاء feed
feed = {
    "name": "mon-feed",
    "description": "Feed pour mes packages"
}

# إنشاء الـ feed
client.create_feed(feed)

# نشر حزمة
package = {
    "name": "mon-package",
    "version": "1.0.0",
    "description": "Description du package"
}

# نشر الحزمة
client.create_package(
    feed_id="<feed_id>",
    package=package
)

Azure Boards

Azure Boards لإدارة المشاريع.

إنشاء عنصر عمل (work item)

from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication

# إنشاء الاتصال
credentials = BasicAuthentication('', '<pat_token>')
connection = Connection(base_url='<organization_url>', creds=credentials)
client = connection.clients.get_work_item_tracking_client()

# إنشاء عنصر عمل
work_item = {
    "op": "add",
    "path": "/fields/System.Title",
    "value": "Nouvelle tâche"
}

# إنشاء عنصر العمل
client.create_work_item(
    document=work_item,
    project="mon-projet",
    type="Task"
)

Azure Test Plans

Azure Test Plans لإدارة الاختبارات.

إنشاء خطة اختبار

from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication

# إنشاء الاتصال
credentials = BasicAuthentication('', '<pat_token>')
connection = Connection(base_url='<organization_url>', creds=credentials)
client = connection.clients.get_test_client()

# إنشاء خطة اختبار
test_plan = {
    "name": "Plan de test",
    "description": "Description du plan",
    "startDate": "2024-03-22",
    "endDate": "2024-04-22"
}

# إنشاء الخطة
client.create_test_plan(
    test_plan=test_plan,
    project="mon-projet"
)

أفضل الممارسات

  1. إدارة الشيفرة

    • استخدام Git Flow
    • إجراء مراجعات للشيفرة
    • الحفاظ على التوثيق
  2. CI/CD

    • أتمتة الاختبارات
    • استخدام البيئات
    • إدارة الأسرار
  3. الحزم

    • إدارة الإصدارات بشكل صحيح
    • الحفاظ على تحديث التبعيات
    • تأمين الـ feeds
  4. المشروع

    • اتباع المنهجيات
    • استخدام السبرنتات (sprints)
    • الحفاظ على الـ backlog

الخاتمة

أهم النقاط التي ينبغي تذكرها:

  • خدمات DevOps متكاملة
  • التكامل المستمر
  • إدارة المشاريع بمنهجية Agile
  • توثيق جيد

التوصيات:

  • ابدأ بـ Git
  • أعدّ CI/CD
  • استخدم السبرنتات
  • اتبع أفضل الممارسات
  • تدرّب عبر Microsoft Learn
InSkillCoach

نبذة عن InSkillCoach

خبير في التدريب والتقنيات

مدرّب متخصص في التقنيات المتقدمة والذكاء الاصطناعي، تدعمه شركة GNeurone Inc.

الشهادات:

  • AWS Certified Solutions Architect – Professional
  • شهادات Google Cloud
  • Microsoft Certified: DevOps Engineer Expert
  • Certified Kubernetes Administrator (CKA)
  • CompTIA Security+
531
123

التعليقات

التعليقات مدعومة عبر GitHub Discussions

سجّل الدخول باستخدام GitHub للمشاركة في النقاش

تم نسخ الرابط!