-
Notifications
You must be signed in to change notification settings - Fork 559
148 lines (138 loc) · 5.51 KB
/
_dagger_call.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: "dagger call"
on:
workflow_call:
inputs:
function:
description: "The Dagger function to call"
type: string
required: true
dev-engine:
description: "Whether to run against a dev Engine"
type: boolean
default: false
required: false
timeout:
description: "How many minutes to timeout after"
type: number
required: false
# None of our jobs should take longer than 30 mins to run.
# If they do, set this explicitly.
default: 30
size:
type: string
default: "dagger-v0-11-4-4c-nvme"
required: false
dagger-version:
type: string
default: "0.11.4"
required: false
jobs:
# Use a free GitHub Actions runner when NOT running in the dagger/dagger repo
github-free-runner:
if: ${{ github.repository != 'dagger/dagger' }}
runs-on: ubuntu-latest
timeout-minutes: ${{ inputs.timeout }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache-dependency-path: "ci/go.sum"
- name: Install dagger
run: |
curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=${{ inputs.dagger-version }} BIN_DIR=/usr/local/bin/ sudo -E sh
- name: Waiting for Dagger Engine to be ready...
run: |
if [ "${{ inputs.dev-engine }}" == "true" ]
then
./hack/dev
export _EXPERIMENTAL_DAGGER_CLI_BIN="$PWD/bin/dagger"
echo "_EXPERIMENTAL_DAGGER_CLI_BIN=${_EXPERIMENTAL_DAGGER_CLI_BIN}" >> "$GITHUB_ENV"
export _EXPERIMENTAL_DAGGER_RUNNER_HOST=docker-container://dagger-engine.dev
echo "_EXPERIMENTAL_DAGGER_RUNNER_HOST=${_EXPERIMENTAL_DAGGER_RUNNER_HOST}" >> "$GITHUB_ENV"
chmod +x $_EXPERIMENTAL_DAGGER_CLI_BIN
fi
dagger call --help
- name: Export secrets
run: |
echo "$SECRET_CONTEXT" | jq -r 'to_entries | .[] | "\(.key | ascii_upcase)=\(.value)"' >> $GITHUB_ENV
env:
SECRET_CONTEXT: ${{ toJson(secrets) }}
- name: ${{ inputs.function }}
run: |
set -x
if [ -f $HOME/.docker/config.json ]; then
dagger call --source=".:default" --host-docker-config=file:"$HOME/.docker/config.json" ${{ inputs.function }}
else
dagger call --source=".:default" ${{ inputs.function }}
fi
# Use new Dagger runners when running in the dagger/dagger repo (including PRs)
dagger-runner-v2:
if: ${{ !inputs.dev-engine && github.repository == 'dagger/dagger' }}
runs-on: ${{ inputs.size }}
concurrency:
group: ${{github.workflow}}-${{ inputs.function }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
timeout-minutes: ${{ inputs.timeout }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache-dependency-path: "ci/go.sum"
- name: Waiting for Dagger Engine to be ready...
run: |
dagger call --help
- name: Export secrets
run: |
echo "$SECRET_CONTEXT" | jq -r 'to_entries | .[] | "\(.key | ascii_upcase)=\(.value)"' >> $GITHUB_ENV
env:
SECRET_CONTEXT: ${{ toJson(secrets) }}
- name: ${{ inputs.function }}
run: |
set -x
if [ -f $HOME/.docker/config.json ]; then
dagger call --source=".:default" --host-docker-config=file:"$HOME/.docker/config.json" ${{ inputs.function }}
else
dagger call --source=".:default" ${{ inputs.function }}
fi
env:
DAGGER_CLOUD_TOKEN: "p.eyJ1IjogIjFiZjEwMmRjLWYyZmQtNDVhNi1iNzM1LTgxNzI1NGFkZDU2ZiIsICJpZCI6ICIwYzhmMGY2Yy00YjY1LTRhODktYTI0YS0yN2NjNWNhNzNmNTcifQ.Em92UDP-KmcNd80Y-euTS2IrRkIE8qTisP3SXYkQi3c"
dagger-runner-v2-dind:
if: ${{ inputs.dev-engine && github.repository == 'dagger/dagger' }}
runs-on: dagger-v0-11-4-dind
concurrency:
group: ${{github.workflow}}-${{ inputs.function }}-${{ github.head_ref || github.run_id }}-v2
cancel-in-progress: true
timeout-minutes: ${{ inputs.timeout }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache-dependency-path: "ci/go.sum"
- name: Build Dagger Dev Engine...
run: |
./hack/dev
docker ps -a
docker image ls
env:
DAGGER_CLOUD_TOKEN: "p.eyJ1IjogIjFiZjEwMmRjLWYyZmQtNDVhNi1iNzM1LTgxNzI1NGFkZDU2ZiIsICJpZCI6ICIwYzhmMGY2Yy00YjY1LTRhODktYTI0YS0yN2NjNWNhNzNmNTcifQ.Em92UDP-KmcNd80Y-euTS2IrRkIE8qTisP3SXYkQi3c"
- name: Waiting for Dagger Dev Engine to be ready...
run: |
dagger call --help
- name: Export secrets
run: |
echo "$SECRET_CONTEXT" | jq -r 'to_entries | .[] | "\(.key | ascii_upcase)=\(.value)"' >> $GITHUB_ENV
env:
SECRET_CONTEXT: ${{ toJson(secrets) }}
- name: ${{ inputs.function }}
run: |
set -x
if [ -f $HOME/.docker/config.json ]; then
dagger call --source=".:default" --host-docker-config=file:"$HOME/.docker/config.json" ${{ inputs.function }}
else
dagger call --source=".:default" ${{ inputs.function }}
fi
env:
DAGGER_CLOUD_TOKEN: "p.eyJ1IjogIjFiZjEwMmRjLWYyZmQtNDVhNi1iNzM1LTgxNzI1NGFkZDU2ZiIsICJpZCI6ICIwYzhmMGY2Yy00YjY1LTRhODktYTI0YS0yN2NjNWNhNzNmNTcifQ.Em92UDP-KmcNd80Y-euTS2IrRkIE8qTisP3SXYkQi3c"