-
Notifications
You must be signed in to change notification settings - Fork 57
170 lines (151 loc) · 4.9 KB
/
build-manual.yaml
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to build off."
default: "main"
type: choice
options:
- main
- dev
- dev-rspm
product:
description: "The product/path to build."
required: true
type: choice
options:
- connect
- connect-content-init
- package-manager
- r-session-complete
- workbench
- workbench-for-google-cloud-workstations
- workbench-for-microsoft-azure-ml
- workbench-session-init
type:
description: "The type of image being built."
required: false
default: "preview"
type: choice
options:
- preview
- daily
- release
version:
description: "The version to build. Use 'auto' to target the latest build."
required: false
default: "auto"
type: string
push:
description: "Flag to push the image after build."
required: false
default: false
type: boolean
name: Manual - Build, Test, and Push
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
GIT_SHA: ${{ steps.get-git-sha.outputs.GIT_SHA }}
BAKE_FILE: ${{ steps.bake-file.outputs.BAKE_FILE }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get commit SHA
id: get-git-sha
run: |
GIT_SHA=$(git rev-parse --short HEAD)
echo "Setting GIT_SHA=$GIT_SHA"
echo "GIT_SHA=$GIT_SHA" >> $GITHUB_OUTPUT
- name: Set BAKE_FILE
id: bake-file
run: |
if [[ "${{ inputs.type }}" == "release" ]]; then
BAKE_FILE="docker-bake.hcl"
else
BAKE_FILE="docker-bake.preview.hcl"
fi
echo "Using $BAKE_FILE"
echo "BAKE_FILE=$BAKE_FILE" >> $GITHUB_OUTPUT
build:
needs: [setup]
runs-on: ubuntu-latest-4x
name: manual-build
permissions:
contents: read
packages: write
env:
GIT_SHA: ${{ needs.setup.outputs.GIT_SHA }}
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Set up Just
uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Python dependencies
run: |
pip install requests
- name: Get Target
id: get-target
shell: bash
run: |
# Append suffix if necessary
target="${{ inputs.product }}"
if [[ "${{ inputs.type }}" != "release" ]]; then
target="${{ inputs.product }}-${{ inputs.type }}"
fi
echo "Setting TARGET=$target"
echo "TARGET=$target" >> $GITHUB_OUTPUT
- name: Get Version
id: get-version
shell: bash
run: |
# Determine how to set the version
if [[ "${{ inputs.version }}" == "auto" ]]; then
VERSION=`just -f ci.Justfile get-version ${{ inputs.product }} --type=${{ inputs.type }} --local`
else
VERSION="${{ inputs.version }}"
fi
# Set the appropriate env var
suffix="_VERSION"
if [[ "${{ inputs.type }}" == "preview" ]]; then
suffix="_PREVIEW_VERSION"
elif [[ "${{ inputs.type }}" == "daily" ]]; then
suffix="_DAILY_VERSION"
fi
product="${{ inputs.product }}"
if [[ "$product" == "connect" ]] || [[ "$product" == "connect-content-init" ]] || [[ "$product" == "content-images" ]]; then
product="CONNECT"
elif [[ "$product" == "package-manager" ]]; then
product="PACKAGE_MANAGER"
elif [[ "$product" == "workbench-session-init" ]]; then
product="WORKBENCH_SESSION_INIT"
else
product="WORKBENCH"
fi
echo "Setting $product$suffix=$VERSION"
echo "$product$suffix=$VERSION" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: setup-buildx
with:
buildkitd-config: ./share/buildkitd.toml
- name: Build/Test/Push manual build image
uses: ./.github/actions/bake-test-push
with:
target: ${{ steps.get-target.outputs.TARGET }}
bakefile: ${{ needs.setup.outputs.BAKE_FILE }}
push-image: ${{ inputs.push }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
gcp-json: '${{ secrets.GCP_ARTIFACT_REGISTRY_JSON }}'
snyk-org: ${{ secrets.SNYK_ORG }}
snyk-token: '${{ secrets.SNYK_TOKEN }}'