• Azure DevOps Self-Hosted Agent, Azure DevOps da kullanılan bir araçtır. Bu araç, Azure DevOps da yer alan CI/CD süreçlerinin yönetilmesinde kullanılır. Kendi bilgisayarınızda veya sunucunuzda çalışan bir agent olarak görev yapar ve Azure DevOps da yer alan görevleri yerine getirir. Bu sayede Azure DevOps üzerinde bulunan projelerin, kendi altyapınızda veya sunucunuzda da sorunsuz bir şekilde çalışmasını sağlar. Özellikle güvenlik gerektiren veya yüksek performans gerektiren projelerde kullanılmaktadır. Bu sayede tüm serverlarınızı daha efektif bir şekilde kullanabilirsiniz.
• Azure DevOps Self-Hosted Agent is a tool used in Azure DevOps for managing CI/CD processes. It functions as an agent running on your own computer or server and performs tasks in Azure DevOps. This enables projects in Azure DevOps to run smoothly on your infrastructure or server. It is especially useful for projects requiring high security or high performance, allowing you to use all your servers more effectively.
1-) Kurulumdan önce işletim sistemimizin paketlerini güncellemek için aşağıdaki komutları çalıştırıyoruz.
sudo apt-get update
sudo apt-get upgrade
2-) Eğer işletim sistemimizde "WGET" yüklü değilse öncelikle wget kurulumu yapmamız gerekiyor, wget kurulumu yapmak için aşağıdaki komutu çalıştırın.
2-) If "WGET" is not installed on our operating system, we need to install it first. To install WGET, run the following command.
sudo apt-get install wget
sudo mkdir azure-agent
4-) Organization Settings → Pipelines → Agent Pools a tıklayalım ve yeni bir pool oluşturmak için “Add Pool” a tıklayalım.
4-) Let's click on Organization Settings → Pipelines → Agent Pools and to create a new pool, click on "Add Pool".
5-) Açılan ekranda pool için isim ve açıklama yazmanız gerekmektedir. Tüm pipelinelara erişim yetkisi vermek için “Grant access permission to all pipelines” ı seçebilirsiniz.
5-) On the screen that appears, you need to enter a name and description for the pool. You can select "Grant access permission to all pipelines" to give access permission to all pipelines.
• Yukarıdaki adımları tamamladıktan sonra bizi aşağıdaki ekran karşılamaktadır.
• After completing the above steps, we are greeted with the following screen.
wget https://vstsagentpackage.azureedge.net/agent/2.218.1/vsts-agent-linux-x64-2.218.1.tar.gz
8-) ".tar" uzantılı arşiv dosyasını bulunduğumuz klasöre çıkartmak için aşağıdaki komutu çalıştırıyoruz.
tar -xvf vsts-agent-linux-x64-2.218.1.tar.gz
9-) Personal Access Token’ı oluşturalım, bunun için aşağıdaki adımları sırasıyla uygulamamız gerekiyor.
• User settings → Personal Access Token → New Token
• Burada hangi organization için bu agenta yetki vermek istiyorsanız onu seçmelisiniz. Sonrasında expiration için 30–60–90 günlük yerine “Custom defined” seçeneği ile daha uzun bir süre verebilirsiniz, 1 seneyi aşmamak koşuluyla.
• Here, you should select the organization for which you want to authorize this agent. Afterwards, you can provide a longer expiration period by selecting the "Custom defined" option instead of 30-60-90 days, provided that it does not exceed 1 year.
11-) " config.sh " çalıştırıp agentı create etmeye başlıyoruz, bunun için aşağıdaki bazı komutları sırasıyla çalıştırmamız lazım.
11-) We need to run some commands in order to create the agent by running "config.sh". Here are the commands that we need to run in order.
export AGENT_ALLOW_RUNASROOT="1"
./config.sh
Y
https://dev.azure.com/Organization Name
PAT
Agent Pool Name (Dogukan)
./run.sh
15-) After the successful execution of the agent, you should receive an email similar to the following.
• Profesyonel iş hayatında büyük projelerde çalışmaya başladığımız zaman bütün agentlar'ı manuel yönetmek biraz karmaşık ve zor olabilir, böyle durumlarda imdadımıza Azure DevOps'un " Agent Schedule " özelliği yetişiyor. Bu özellik, oluşturulan agent'ı tercihlerimize göre yönetmemizi sağlar. Yani agent'ı önceden planlayarak istediğimiz gün ve saat aralığında çalıştırabiliyoruz.
• When starting to work on large projects in a professional business environment, manually managing all agents can be a bit complicated and difficult. In such situations, Azure DevOps' "Agent Schedule" feature comes to our aid. This feature allows us to manage the created agent according to our preferences. That is, we can run the agent on the day and time range we want by planning it in advance.
• Örnek bir projede bu özelleği denemek için aşağıdaki adımları tek tek uygulamamız gerekiyor.
• To try this feature on a sample project, we need to follow the steps below one by one.
Pipelines → Edit Pipelines → Triggers → Scheduled → Add
• Sorunsuz çalışıp çalışmadığını kontrol ederken dikkat etmemiz gereken alan 'Scheduled' yazan 'Summary' bölümüdür.
• When checking for smooth operation, the area we should pay attention to is the "Summary" section indicating "Scheduled".