forked from semgrep/semgrep
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (113 loc) · 3.78 KB
/
build-test-docker.yml
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
# AUTOGENERATED FROM build-test-docker.jsonnet DO NOT MODIFY
jobs:
job:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- if: ${{ matrix.architecture != 'amd64' }}
uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v2
- id: meta
name: Set tags and labels
uses: docker/metadata-action@v5
with:
flavor: ${{ inputs.docker-flavor }}
images: ${{ inputs.repository-name }}
tags: ${{ inputs.docker-tags }}
- uses: depot/setup-action@v1
- id: build-image
name: Build image
uses: depot/build-push-action@v1.9.0
with:
buildx-fallback: false
file: ${{ inputs.file }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/image.tar
platforms: linux/${{ matrix.architecture }}
project: fhmxj6w9z8
secrets: SEMGREP_APP_TOKEN=${{ secrets.SEMGREP_APP_TOKEN }}
tags: ${{ steps.meta.outputs.tags }}
target: ${{ inputs.target }}
- if: ${{ inputs.enable-tests }}
name: Load image
run: docker load --input /tmp/image.tar
- if: ${{ inputs.enable-tests }}
uses: actions/checkout@v3
- if: ${{ inputs.enable-tests }}
name: Test Image
run: ./scripts/validate-docker-build.sh ${{ steps.build-image.outputs.imageid }} linux/${{ matrix.architecture }}
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact-name }}-arch-${{ matrix.architecture }}
path: /tmp/image.tar
strategy:
matrix:
architecture:
- amd64
- arm64
name: build-test-docker
on:
workflow_call:
inputs:
artifact-name:
description: Name (key) to use when uploading the docker image tarball as a artifact
required: true
type: string
docker-flavor:
description: 'Multi-line string for the metadata tag action for the flavor of the image. '
required: true
type: string
docker-tags:
description: 'Multi-line string for the metadata tag action for the tags to apply to the image. '
required: true
type: string
enable-tests:
description: Whether or not to run validation on the built image
required: true
type: boolean
file:
description: Dockerfile to build
required: true
type: string
repository-name:
description: The repository/name of the docker image to push, e.g., returntocorp/semgrep
required: true
type: string
target:
description: Dockerfile target to build
required: true
type: string
workflow_dispatch:
inputs:
artifact-name:
description: Name (key) to use when uploading the docker image tarball as a artifact
required: true
type: string
docker-flavor:
description: 'Multi-line string for the metadata tag action for the flavor of the image. '
required: true
type: string
docker-tags:
description: 'Multi-line string for the metadata tag action for the tags to apply to the image. '
required: true
type: string
enable-tests:
description: Whether or not to run validation on the built image
required: true
type: boolean
file:
default: Dockerfile
description: Dockerfile to build
required: true
type: string
repository-name:
default: returntocorp/semgrep
description: The repository/name of the docker image to push, e.g., returntocorp/semgrep
required: true
type: string
target:
description: Dockerfile target to build
required: true
type: string