Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed Apr 23, 2024
2 parents 56fdcde + 958127b commit 66d82a2
Show file tree
Hide file tree
Showing 59 changed files with 1,685 additions and 397 deletions.
202 changes: 138 additions & 64 deletions .github/workflows/pipeline.yaml

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cicd/version
docs/themes/hextra
src/helm/azure-pipelines-agent/templates
*.enc.json
cicd/version/
docs/public/
docs/themes/hextra/
src/helm/blue-agent/templates/
3 changes: 3 additions & 0 deletions .sops.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
creation_rules:
- age: age1up54yhdjs672usk4etmy8naa5uh0qamy5tn3nmkwua5vp6fn7v7qz80945
encrypted_regex: value
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"editorconfig.editorconfig",
"ms-azure-devops.azure-pipelines",
"ms-azuretools.vscode-bicep",
"ms-azuretools.vscode-docker",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"snyk-security.snyk-vulnerability-scanner"
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"yaml.schemas": {
"https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json": "test/pipeline/*.yaml"
}
}
65 changes: 60 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,79 @@
.PHONY: test lint build-docker docs build-docs

# Required parameters
flavor ?= null
version ?= null
# Dynamic parameters
prefix ?= $(shell hostname | tr '[:upper:]' '[:lower:]' | tr '.' '-')
deployment_name ?= $(prefix)-$(flavor)
# Deployment outputs
job_name ?= $(shell az deployment sub show --name '$(deployment_name)' | yq '.properties.outputs["jobName"].value')
rg_name ?= $(shell az deployment sub show --name '$(deployment_name)' | yq '.properties.outputs["rgName"].value')

test:
@echo "➡️ Running Prettier..."
@echo "➡️ Running Prettier"
npx --yes [email protected] --editorconfig --check .

@echo "➡️ Running Hadolint..."
@echo "➡️ Running Hadolint"
find . -name "Dockerfile*" -exec bash -c "echo 'File {}:' && hadolint {}" \;

@echo "➡️ Running Azure Bicep Validate"
az deployment sub validate \
--location westeurope \
--no-prompt \
--parameters test/bicep/lint.example.json \
--template-file src/bicep/main.bicep \
--verbose

lint:
@echo "➡️ Running Prettier..."
@echo "➡️ Running Prettier"
npx --yes [email protected] --editorconfig --write .

@echo "➡️ Running Hadolint..."
@echo "➡️ Running Hadolint"
find . -name "Dockerfile*" -exec bash -c "echo 'File {}:' && hadolint {}" \;

@echo "➡️ Running Bicep lint"
az bicep lint \
--file src/bicep/main.bicep \
--verbose

deploy-bicep:
@echo "➡️ Decrypting Bicep parameters"
sops -d test/bicep/test.enc.json > test/bicep/test.json

@echo "➡️ Deploying Bicep"
az deployment sub create \
--location westeurope \
--name $(deployment_name) \
--no-prompt \
--parameters \
test/bicep/test.json \
imageFlavor=$(flavor) \
imageVersion=$(version) \
--template-file src/bicep/main.bicep

@echo "➡️ Cleaning up Bicep parameters"
rm test/bicep/test.json

@echo "➡️ Starting init job"
az containerapp job start \
--name $(job_name) \
--resource-group $(rg_name)

destroy-bicep:
@echo "➡️ Destroying"
az group delete \
--name "$(rg_name)" \
--yes

integration:
@bash test/integration.sh $(prefix) $(flavor) $(version) $(job_name)

docs:
cd docs && hugo server

build-docker:
bash cicd/docker-build-local.sh
@bash cicd/docker-build-local.sh

build-docs:
cd docs && hugo --gc --minify
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
# Azure Pipelines Agent
> [!IMPORTANT]
> Projet name is now Blue Agent! Was previously known as Azure Pipelines Agent.
# Blue Agent

<!-- Use absolute path for images in README.md, so that they are displayed on ArtifactHub.io, Lens, OpenLens, etc. -->
<img src="https://raw.githubusercontent.com/clemlesne/azure-pipelines-agent/main/docs/static/favicon.svg" width="100">
<img src="https://raw.githubusercontent.com/clemlesne/blue-agent/main/docs/static/favicon.svg" width="100">

[Azure Pipelines Agent](https://github.com/clemlesne/azure-pipelines-agent) is self-hosted agent in Kubernetes, cheap to run, secure, auto-scaled and easy to deploy.
[Blue Agent](https://github.com/clemlesne/blue-agent) is self-hosted agent in Kubernetes, cheap to run, secure, auto-scaled and easy to deploy.

<!-- github.com badges -->

[![Docker pulls](https://img.shields.io/docker/pulls/clemlesne/azure-pipelines-agent?label=docker.com%20pulls)](https://hub.docker.com/r/clemlesne/azure-pipelines-agent)
[![GitHub all releases](https://img.shields.io/github/downloads/clemlesne/azure-pipelines-agent/total?label=github.com%20downloads)](https://github.com/clemlesne/azure-pipelines-agent/pkgs/container/azure-pipelines-agent)
[![Last release date](https://img.shields.io/github/release-date/clemlesne/azure-pipelines-agent)](https://github.com/clemlesne/azure-pipelines-agent/releases)
[![Project license](https://img.shields.io/github/license/clemlesne/azure-pipelines-agent)](https://github.com/clemlesne/azure-pipelines-agent/blob/main/LICENSE)
[![Docker pulls](https://img.shields.io/docker/pulls/clemlesne/blue-agent?label=docker.com%20pulls)](https://hub.docker.com/r/clemlesne/blue-agent)
[![GitHub all releases](https://img.shields.io/github/downloads/clemlesne/blue-agent/total?label=github.com%20downloads)](https://github.com/clemlesne/blue-agent/pkgs/container/blue-agent)
[![Last release date](https://img.shields.io/github/release-date/clemlesne/blue-agent)](https://github.com/clemlesne/blue-agent/releases)
[![Project license](https://img.shields.io/github/license/clemlesne/blue-agent)](https://github.com/clemlesne/blue-agent/blob/main/LICENSE)

<!-- artifacthub.io badges -->

[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/azure-pipelines-agent)](https://artifacthub.io/packages/search?repo=azure-pipelines-agent)
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/azure-pipelines-agent-container)](https://artifacthub.io/packages/search?repo=azure-pipelines-agent-container)
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/blue-agent)](https://artifacthub.io/packages/search?repo=blue-agent)
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/blue-agent-container)](https://artifacthub.io/packages/search?repo=blue-agent-container)

Features:
## Features

- 🔄 Agent register and restart itself.
- 🏗️ Allow to build containers inside the agent using [BuildKit](https://github.com/moby/buildkit).
Expand All @@ -29,9 +32,15 @@ Features:
- 📦 [SBOM (Software Bill of Materials)](https://en.wikipedia.org/wiki/Software_supply_chain) is packaged with each container image.
- 🔄 System updates are applied every day.

## How to deploy

[Deployment is available](https://clemlesne.github.io/blue-agent/docs/getting-started) using Helm on a Kubernetes cluster or Bicep on Azure Container Apps.

[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fclemlesne%2Fblue-agent%2Fmain%2Fsrc%2Fbicep%2Fmain.bicep)

## Documentation

Documentation is available at [clemlesne.github.io/azure-pipelines-agent](https://clemlesne.github.io/azure-pipelines-agent/).
Documentation is available at [clemlesne.github.io/blue-agent](https://clemlesne.github.io/blue-agent/).

## [Code of conduct](./CODE_OF_CONDUCT.md)

Expand Down
2 changes: 1 addition & 1 deletion cicd/docker-build-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ echo "Matrix:${SUFFIXES}"

# Iterate over the suffixes and build the Docker images
for suffix in ${SUFFIXES}; do
tag="ghcr.io/clemlesne/azure-pipelines-agent:${suffix}-latest"
tag="ghcr.io/clemlesne/blue-agent:${suffix}-latest"
echo "➡️ Building Docker image for ${suffix} (${tag})"

# Build the Docker image
Expand Down
6 changes: 3 additions & 3 deletions docs/content/_index.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
title: Azure Pipelines Agent
title: Blue Agent
layout: hextra-home
---

<div class="mt-6 mb-6">
{{< hextra/hero-headline >}}
Manage Azure Pipelines Agent<br class="sm:block hidden" />in Kubernetes
Manage Blue Agent<br class="sm:block hidden" />in Kubernetes
{{< /hextra/hero-headline >}}
</div>

<div class="mb-12">
{{< hextra/hero-subtitle >}}
Azure Pipelines Agent is self-hosted agent in Kubernetes, cheap to run, secure, auto-scaled and easy to deploy.
Blue Agent is self-hosted Azure Pipelines agent in Kubernetes, cheap to run, secure, auto-scaled and easy to deploy.
{{< /hextra/hero-subtitle >}}
</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/content/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: About
toc: false
---

This project is open source and maintained by people like you. If you need help or found a bug, please feel free to open an issue on the [clemlesne/azure-pipelines-agent](https://github.com/clemlesne/azure-pipelines-agent) GitHub project.
This project is open source and maintained by people like you. If you need help or found a bug, please feel free to open an issue on the [clemlesne/blue-agent](https://github.com/clemlesne/blue-agent) GitHub project.

This project is not affiliated or endorsed by Microsoft.

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ linkTitle: Documentation
title: Introduction
---

Azure Pipelines Agent is self-hosted agent in Kubernetes, cheap to run, secure, auto-scaled and easy to deploy.
Blue Agent is self-hosted Azure Pipelines agent in Kubernetes, cheap to run, secure, auto-scaled and easy to deploy.

## Features

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/advanced-topics/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Advanced topics
weight: 2
---

Explore the following sections to learn how to use Azure Pipelines Agent:
Explore the following sections to learn how to use Blue Agent:

{{< cards >}}
{{< card link="build-aspnet" title="Build ASP.NET applications" icon="code" >}}
Expand Down
26 changes: 26 additions & 0 deletions docs/content/docs/advanced-topics/bicep-deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: Deploy on Azure with Bicep
---

Bicep is a deployment language for Azure, allowing to easily deploy resources on the cloud.

#### Bicep parameters

| Parameter | Description | Default |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------ |
| `autoscalingMaxReplicas` | Maximum number of simultaneous jobs the agent can run | `100` |
| `autoscalingMinReplicas` | Minimum number of replicas the agent should have | `0` |
| `extraEnv` | Extra environment variables to pass to the agent | `[]` |
| `imageFlavor` | Flavor of the container image, represents the Linux distribution. Allowed values: `bookworm`, `bullseye`, `focal`, `jammy`, `ubi8`, `ubi9` | `bookworm` |
| `imageName` | Name of the container image | `clemlesne/blue-agent` |
| `imageRegistry` | Registry of the container image. Allowed values: `docker.io`, `ghcr.io` | `ghcr.io` |
| `imageVersion` | Version of the container image, it is recommended to use a specific version like "1.0.0" instead of "latest" | `main` |
| `instance` | Name of the instance, will be used to build the name of the resources | Value from `deployment().name` |
| `location` | Location of resources | `westeurope` |
| `pipelinesCapabilities` | Capabilities of the agent | `['arch_x64']` |
| `pipelinesOrganizationURL` | URL of the Azure DevOps organization | _None_ |
| `pipelinesPersonalAccessToken` | Personal access token allowing the agent to connect to the Azure DevOps organization. This parameter is secure. | _None_ |
| `pipelinesPoolName` | Name of the Azure Pipelines self-hosted pool the agent should be added to | _None_ |
| `pipelinesTimeout` | Timeout in seconds for the agent to run a job before it is automatically terminated | `3600` |
| `resourcesCpu` | Number of CPU cores allocated to the agent | `2` |
| `resourcesMemory` | Amount of memory allocated to the agent | `4Gi` |
2 changes: 1 addition & 1 deletion docs/content/docs/advanced-topics/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extraNodeSelectors:
Deploy the Helm instance:
```bash
❯ helm upgrade --install agent-arm64 clemlesne-azure-pipelines-agent/azure-pipelines-agent -f values.yaml
❯ helm upgrade --install agent-arm64 clemlesne-blue-agent/blue-agent -f values.yaml
```

Update the Azure Pipelines file in the repository to use the new pool:
Expand Down
20 changes: 10 additions & 10 deletions docs/content/docs/advanced-topics/docker-in-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ We choose BuildKit for this project. [Its license](https://raw.githubusercontent

Linux systems are supported, but not Windows:

| `Ref` | Container build inside of the agent with BuildKit |
| ----------------------------------------------------------- | ------------------------------------------------- |
| `ghcr.io/clemlesne/azure-pipelines-agent:bookworm-main` ||
| `ghcr.io/clemlesne/azure-pipelines-agent:bullseye-main` ||
| `ghcr.io/clemlesne/azure-pipelines-agent:focal-main` ||
| `ghcr.io/clemlesne/azure-pipelines-agent:jammy-main` ||
| `ghcr.io/clemlesne/azure-pipelines-agent:ubi8-main` ||
| `ghcr.io/clemlesne/azure-pipelines-agent:ubi9-main` ||
| `ghcr.io/clemlesne/azure-pipelines-agent:win-ltsc2019-main` ||
| `ghcr.io/clemlesne/azure-pipelines-agent:win-ltsc2022-main` ||
| `Ref` | Container build inside of the agent with BuildKit |
| ------------------------------------------------ | ------------------------------------------------- |
| `ghcr.io/clemlesne/blue-agent:bookworm-main` ||
| `ghcr.io/clemlesne/blue-agent:bullseye-main` ||
| `ghcr.io/clemlesne/blue-agent:focal-main` ||
| `ghcr.io/clemlesne/blue-agent:jammy-main` ||
| `ghcr.io/clemlesne/blue-agent:ubi8-main` ||
| `ghcr.io/clemlesne/blue-agent:ubi9-main` ||
| `ghcr.io/clemlesne/blue-agent:win-ltsc2019-main` ||
| `ghcr.io/clemlesne/blue-agent:win-ltsc2022-main` ||

#### How to use the bundled BuildKit

Expand Down
Loading

0 comments on commit 66d82a2

Please sign in to comment.