-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
689 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[Makefile] | ||
indent_size = 4 | ||
indent_style = tab |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,144 +1,163 @@ | ||
name: Pipeline | ||
|
||
on: | ||
push: | ||
paths: | ||
- "src/**" | ||
- ".github/workflows/**" | ||
pull_request: | ||
paths: | ||
- "src/**" | ||
- ".github/workflows/**" | ||
|
||
env: | ||
version: 2.2.${{github.run_number}} | ||
imageRepository: "emberstack/azure-pipelines-agent" | ||
DOCKER_CLI_EXPERIMENTAL: "enabled" | ||
|
||
|
||
jobs: | ||
ci: | ||
name: CI | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: tools - helm - install | ||
uses: azure/setup-helm@v1 | ||
|
||
|
||
|
||
- name: artifacts - prepare directories | ||
run: mkdir -p .artifacts/helm | ||
|
||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: helm - import README | ||
run: cp README.md src/helm/azure-pipelines-agent/README.md | ||
|
||
- name: helm - template chart | ||
run: helm package --destination .artifacts/helm --version ${{env.version}} --app-version ${{env.version}} src/helm/azure-pipelines-agent | ||
|
||
- name: "artifacts - upload - helm chart" | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: helm | ||
path: .artifacts/helm | ||
|
||
- name: "docker - build" | ||
run: | | ||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
docker buildx create --name builder --driver docker-container --use | ||
docker buildx inspect --bootstrap | ||
docker buildx build --platform linux/amd64 -t ${{env.imageRepository}}:build-${{env.version}}-amd64 -f src/docker/Dockerfile src/docker | ||
docker buildx build --platform linux/arm -t ${{env.imageRepository}}:build-${{env.version}}-arm32v7 -f src/docker/Dockerfile src/docker | ||
docker buildx build --platform linux/arm64 -t ${{env.imageRepository}}:build-${{env.version}}-arm64v8 -f src/docker/Dockerfile src/docker | ||
- name: tools - docker - login | ||
if: github.event_name == 'push' | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.ES_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.ES_DOCKERHUB_PAT }} | ||
|
||
- name: "docker - build and push" | ||
if: github.event_name == 'push' | ||
run: | | ||
docker buildx build --push --platform linux/amd64 -t ${{env.imageRepository}}:build-${{env.version}}-amd64 -f src/docker/Dockerfile src/docker | ||
docker buildx build --push --platform linux/arm -t ${{env.imageRepository}}:build-${{env.version}}-arm32v7 -f src/docker/Dockerfile src/docker | ||
docker buildx build --push --platform linux/arm64 -t ${{env.imageRepository}}:build-${{env.version}}-arm64v8 -f src/docker/Dockerfile src/docker | ||
docker manifest create ${{env.imageRepository}}:build-${{env.version}} ${{env.imageRepository}}:build-${{env.version}}-amd64 ${{env.imageRepository}}:build-${{env.version}}-arm32v7 ${{env.imageRepository}}:build-${{env.version}}-arm64v8 | ||
docker manifest inspect ${{env.imageRepository}}:build-${{env.version}} | ||
docker manifest push ${{env.imageRepository}}:build-${{env.version}} | ||
cd: | ||
name: CD | ||
needs: ci | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: tools - helm - install | ||
uses: azure/setup-helm@v1 | ||
|
||
- name: tools - docker - login | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.ES_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.ES_DOCKERHUB_PAT }} | ||
|
||
- name: artifacts - download - helm chart | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: helm | ||
path: .artifacts/helm | ||
|
||
- name: "docker - tag and push" | ||
run: | | ||
docker pull ${{env.imageRepository}}:build-${{env.version}}-amd64 | ||
docker pull ${{env.imageRepository}}:build-${{env.version}}-arm32v7 | ||
docker pull ${{env.imageRepository}}:build-${{env.version}}-arm64v8 | ||
docker manifest create ${{env.imageRepository}}:${{env.version}} ${{env.imageRepository}}:build-${{env.version}}-amd64 ${{env.imageRepository}}:build-${{env.version}}-arm32v7 ${{env.imageRepository}}:build-${{env.version}}-arm64v8 | ||
docker manifest create ${{env.imageRepository}}:latest ${{env.imageRepository}}:build-${{env.version}}-amd64 ${{env.imageRepository}}:build-${{env.version}}-arm32v7 ${{env.imageRepository}}:build-${{env.version}}-arm64v8 | ||
docker manifest push ${{env.imageRepository}}:${{env.version}} | ||
docker manifest push ${{env.imageRepository}}:latest | ||
docker manifest push ${{env.imageRepository}}:${{env.version}} | ||
docker manifest push ${{env.imageRepository}}:latest | ||
docker tag ${{env.imageRepository}}:build-${{env.version}}-amd64 ${{env.imageRepository}}:${{env.version}}-amd64 | ||
docker tag ${{env.imageRepository}}:build-${{env.version}}-arm32v7 ${{env.imageRepository}}:${{env.version}}-arm32v7 | ||
docker tag ${{env.imageRepository}}:build-${{env.version}}-arm64v8 ${{env.imageRepository}}:${{env.version}}-arm64v8 | ||
docker push ${{env.imageRepository}}:${{env.version}}-amd64 | ||
docker push ${{env.imageRepository}}:${{env.version}}-arm32v7 | ||
docker push ${{env.imageRepository}}:${{env.version}}-arm64v8 | ||
- name: github - checkout - helm-charts | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: emberstack/helm-charts | ||
token: ${{ secrets.ES_GITHUB_PAT }} | ||
path: helm-charts | ||
|
||
|
||
- name: github - publish - chart | ||
run: | | ||
mkdir -p helm-charts/charts | ||
cp .artifacts/helm/azure-pipelines-agent-${{env.version}}.tgz helm-charts/charts | ||
cd helm-charts | ||
rm -f index.yaml | ||
helm repo index ./ | ||
git config user.name "Romeo Dumitrescu" | ||
git config user.email "[email protected]" | ||
git add . | ||
git status | ||
git commit -m "Added azure-pipelines-agent-${{env.version}}.tgz" | ||
git push | ||
- name: github - create release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
repository: emberstack/docker-azure-pipelines-agent | ||
tag_name: v${{env.version}} | ||
body: The release process is automated. | ||
token: ${{ secrets.ES_GITHUB_PAT }} | ||
name: pipeline | ||
|
||
on: | ||
schedule: | ||
- cron: 0 0 * * 1 | ||
push: | ||
branches: | ||
- develop | ||
- feat/* | ||
- hotfix/* | ||
- main | ||
pull_request: | ||
branches: | ||
- develop | ||
- feat/* | ||
- hotfix/* | ||
- main | ||
|
||
env: | ||
CONTAINER_NAME: ${{ github.repository }} | ||
CONTAINER_REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-helm: | ||
name: Build Helm chart | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
|
||
- name: Version | ||
id: version | ||
run: | | ||
echo "version=$(make version)" >> $GITHUB_OUTPUT | ||
echo "version_full=$(make version-full)" >> $GITHUB_OUTPUT | ||
- name: Setup Helm | ||
uses: azure/setup-helm@v3 | ||
with: | ||
version: v3.11.2 | ||
|
||
- name: Package Helm chart | ||
run: | | ||
helm package \ | ||
--version ${{ steps.version.outputs.version }} \ | ||
--app-version ${{ steps.version.outputs.version }} \ | ||
--destination .cr-release-packages \ | ||
src/helm/azure-pipelines-agent | ||
- name: Upload Helm chart | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: helm-chart | ||
path: .cr-release-packages | ||
|
||
deploy-helm: | ||
name: Deploy Helm chart | ||
needs: build-helm | ||
if: github.ref == 'refs/heads/main' # Only deploy on main branch, as there is only one Helm repo | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Download Helm chart | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: helm-chart | ||
path: .cr-release-packages | ||
|
||
- name: Archive Helm chart | ||
uses: helm/[email protected] | ||
with: | ||
charts_dir: src/helm | ||
skip_packaging: true | ||
env: | ||
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build-deploy-docker: | ||
name: Build & deploy container image "${{ matrix.os }}" | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
include: | ||
- os: bullseye | ||
arch: linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8 | ||
- os: buster | ||
arch: linux/amd64,linux/arm/v7,linux/arm64/v8 | ||
- os: bionic | ||
arch: linux/amd64,linux/arm/v7,linux/arm64/v8 | ||
- os: focal | ||
arch: linux/amd64,linux/arm/v7,linux/arm64/v8 | ||
- os: jammy | ||
arch: linux/amd64,linux/arm/v7,linux/arm64/v8 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Version | ||
id: version | ||
run: | | ||
echo "version=$(make version)" >> $GITHUB_OUTPUT | ||
echo "version_full=$(make version-full)" >> $GITHUB_OUTPUT | ||
- name: Set up QEMU | ||
id: setup-qemu | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: ${{ matrix.arch }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.CONTAINER_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Container meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_NAME }} | ||
flavor: | | ||
prefix=${{ matrix.os }}- | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=schedule | ||
type=semver,pattern={{version}},value=${{ steps.version.outputs.version_full }} | ||
type=sha | ||
- name: Build/push container | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: src/docker | ||
file: src/docker/Dockerfile-${{ matrix.os }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: ${{ matrix.arch }} | ||
push: true | ||
sbom: true | ||
tags: ${{ steps.meta.outputs.tags }} |
Oops, something went wrong.