-
Notifications
You must be signed in to change notification settings - Fork 4
133 lines (110 loc) · 4.37 KB
/
packMachines.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Pack Virtual Machine Images
on:
push:
branches:
- main
repository_dispatch:
types: [trigger-workflow]
workflow_dispatch:
inputs:
service:
required: true
description: 'The service to build'
type: choice
options:
- dibbs-ecr-viewer
- dibbs-query-connector
version:
required: true
type: string
description: 'The version of the service to build'
default: 'main'
permissions:
contents: read
jobs:
workflow_changes:
with:
what_to_check: ./.github
uses: ./.github/workflows/checkForChanges.yml
packer_changes:
with:
what_to_check: ./packer
uses: ./.github/workflows/checkForChanges.yml
packer_build_changes:
# or push on main
if: needs.workflow_changes.outputs.has_changes == 'true' || needs.packer_changes.outputs.has_changes == 'true' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
matrix:
include:
- provisioners: ${{ inputs.provisioners }}
- services: ['dibbs-ecr-viewer', 'dibbs-query-connector']
steps:
- uses: actions/checkout@v4
- name: Set up Packer
uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232
with:
version: 1.11.2
# Needed for ISO builder
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
- name: Run `packer init`
working-directory: ./packer/ubuntu-server
run: packer init .
- name: Run `packer validate`
working-directory: ./packer/ubuntu-server
run: packer validate --var dibbs_service=${{ matrix.services }} --var dibbs_version=main .
- name: Run `packer build`
working-directory: ./packer/ubuntu-server
run: packer build --var dibbs_service=${{ matrix.services }} --var dibbs_version=main .
packer_build_repository_dispatch:
if: github.event_name == 'repository_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Packer
uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232
with:
version: 1.11.2
# Needed for ISO builder
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
with:
platforms: qemu-system-x86_64
- name: Run `packer init ${{ github.event.client_payload.service }}`
working-directory: ./packer/ubuntu-server
run: packer init .
- name: Run `packer validate ${{ github.event.client_payload.service }}`
working-directory: ./packer/ubuntu-server
run: packer validate --var dibbs_service=${{ github.event.client_payload.service }} --var dibbs_version=${{ github.event.client_payload.version }} .
# workflow_call and workflow_dispatch for either service
- name: Run `packer build ${{ github.event.client_payload.service }}`
working-directory: ./packer/ubuntu-server
run: packer build --var dibbs_service=${{ github.event.client_payload.service }} --var dibbs_version=${{ github.event.client_payload.version }} .
packer_build_workflow_dispatch:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
matrix:
include:
- provisioners: ${{ inputs.provisioners }}
steps:
- uses: actions/checkout@v4
- name: Set up Packer
uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232
with:
version: 1.11.2
# Needed for ISO builder
- name: Set up QEMU
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25
- name: Run `packer init ${{ inputs.service }}`
working-directory: ./packer/ubuntu-server
run: packer init .
- name: Run `packer validate ${{ inputs.service }}`
working-directory: ./packer/ubuntu-server
run: packer validate --var dibbs_service=${{ inputs.service }} --var dibbs_version=${{ inputs.version }} .
# workflow_call and workflow_dispatch for either service
- name: Run `packer build ${{ inputs.service }}`
working-directory: ./packer/ubuntu-server
run: packer build --var dibbs_service=${{ inputs.service }} --var dibbs_version=${{ inputs.version }} .
## TODO: Decide how to export artifact.