summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/.github/workflows/pr-image-tests.yaml
blob: 2cdc362200e06722d68ad0187fa76038fc2ad1a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Build images for all architectures
on:
  pull_request:
    types:
      - opened
      - reopened
      - synchronize
    paths:
      - 'dockerfiles/Dockerfile'
      - 'dockerfiles/Dockerfile.windows'
      - 'conf/**'

  workflow_dispatch:

jobs:
    pr-image-tests-build-images:
      name: PR - Buildkit docker build test
      runs-on: ubuntu-latest
      permissions:
        contents: read
        # We do not push and this allows simpler workflow running for forks too
      steps:
        - name: Checkout code
          uses: actions/checkout@v4

        - name: Set up Docker Buildx
          uses: docker/setup-buildx-action@v3

        - name: Extract metadata from Github
          id: meta
          uses: docker/metadata-action@v5
          with:
            images: ${{ github.repository }}/pr-${{ github.event.pull_request.number }}
            tags: |
              type=sha

        - name: Build the multi-arch images
          id: build
          uses: docker/build-push-action@v5
          with:
            file: ./dockerfiles/Dockerfile
            context: .
            platforms: linux/amd64
            target: production
            provenance: false
            push: false
            load: true
            tags: ${{ steps.meta.outputs.tags }}
            labels: ${{ steps.meta.outputs.labels }}

        - name: Sanity check it runs
          # We do this for a simple check of dependencies
          run: |
            docker run --rm -t ${{ steps.meta.outputs.tags }} --help
          shell: bash

        - name: Build the debug multi-arch images
          uses: docker/build-push-action@v5
          with:
            file: ./dockerfiles/Dockerfile
            context: .
            platforms: linux/amd64
            target: debug
            provenance: false
            push: false
            load: false

    pr-image-tests-classic-docker-build:
      name: PR - Classic docker build test
      runs-on: ubuntu-latest
      permissions:
        contents: read
      steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Build the classic test image
        # We only want to confirm it builds with classic mode, nothing else
        run: |
          docker build -f ./dockerfiles/Dockerfile .
        env:
          # Ensure we disable buildkit
          DOCKER_BUILDKIT: 0
        shell: bash
    pr-image-tests-build-windows-images:
      name: PR - Docker windows build test, windows 2019 and 2022
      runs-on: windows-${{ matrix.windows-base-version }}
      strategy:
        fail-fast: true
        matrix:
          windows-base-version:
            # https://github.com/fluent/fluent-bit/blob/1d366594a889624ec3003819fe18588aac3f17cd/dockerfiles/Dockerfile.windows#L3
            - '2019'
            - '2022'
      permissions:
        contents: read
      steps:
        - name: Checkout repository
          uses: actions/checkout@v4

        - name: Extract metadata from Github
          id: meta
          uses: docker/metadata-action@v5
          with:
            images: ${{ github.repository }}/pr-${{ github.event.pull_request.number }}
            tags: |
              type=sha
            flavor: |
              suffix=-windows-${{ matrix.windows-base-version }}

        - name: Build the windows images
          id: build
          run: |
            docker build -t ${{ steps.meta.outputs.tags }} --build-arg WINDOWS_VERSION=ltsc${{ matrix.windows-base-version }} -f ./dockerfiles/Dockerfile.windows .

        - name: Sanity check it runs
          # We do this for a simple check of dependencies
          run: |
            docker run --rm -t ${{ steps.meta.outputs.tags }} --help
          shell: bash