-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
executable file
·577 lines (526 loc) · 21 KB
/
.gitlab-ci.yml
File metadata and controls
executable file
·577 lines (526 loc) · 21 KB
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# =============================================================================
# ARO Programming Language - GitLab CI/CD Pipeline (Linux Only)
# =============================================================================
# Builds, tests, and releases ARO on Linux using Swift 6.2
# =============================================================================
stages:
- test
- build
- integration
- documentation
- release
- mastodon
variables:
SWIFT_VERSION: '6.2.3'
# Only run pipelines for main, release branches, tags, merge requests, and schedules
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH =~ /^release\/.*/
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- "**/*"
# Default settings for all jobs
default:
interruptible: true
# =============================================================================
# Test Stage - Gate for all builds (main branch only)
# =============================================================================
test:
stage: test
image: swift:6.2-jammy
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH =~ /^release\/.*/
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
cache:
key:
files:
- Package.resolved
prefix: swift-test
paths:
- .build/
policy: pull-push
before_script:
- apt-get update -qq
- apt-get install -y -qq wget gnupg software-properties-common libgit2-dev
# Add LLVM APT repository for LLVM 20 (required for Swifty-LLVM)
- wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
- echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" > /etc/apt/sources.list.d/llvm.list
- apt-get update -qq
- apt-get install -y -qq llvm-20-dev libzstd-dev
# Create pkg-config file for LLVM
- |
cat > /usr/lib/pkgconfig/llvm.pc << 'PKGCONFIG'
prefix=/usr/lib/llvm-20
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: LLVM
Description: Low-level Virtual Machine compiler framework
Version: 20.1
Libs: -L${libdir} -lLLVM-20
Cflags: -I${includedir}
PKGCONFIG
script:
- swift test --parallel
tags:
- spencer
# =============================================================================
# Build Stage - Linux Release Build
# =============================================================================
build:linux:
stage: build
image: swift:6.2-jammy
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH =~ /^release\/.*/
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
needs:
- job: test
optional: true
cache:
key:
files:
- Package.resolved
prefix: swift-build
paths:
- .build/
policy: pull-push
before_script:
- apt-get update -qq
- apt-get install -y -qq git wget gnupg software-properties-common libgit2-dev
# Add LLVM APT repository for LLVM 20 (required for Swifty-LLVM)
- wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
- echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" > /etc/apt/sources.list.d/llvm.list
- apt-get update -qq
- apt-get install -y -qq llvm-20-dev libzstd-dev
# Create pkg-config file for LLVM
- |
cat > /usr/lib/pkgconfig/llvm.pc << 'PKGCONFIG'
prefix=/usr/lib/llvm-20
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: LLVM
Description: Low-level Virtual Machine compiler framework
Version: 20.1
Libs: -L${libdir} -lLLVM-20
Cflags: -I${includedir}
PKGCONFIG
script:
# Debug build
- swift build -c debug
# Run tests again to ensure build is valid
- swift test --parallel
# Generate version file
- |
VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
cat > Sources/AROVersion/Version.swift << 'EOF'
// ============================================================
// Version.swift
// ARO Version Information
// ============================================================
// This file is auto-generated during build
import Foundation
public enum AROVersion {
/// Version from git tag (embedded at build time)
public static let version: String = "VERSION_PLACEHOLDER"
/// Short commit hash (embedded at build time)
public static let commit: String = "COMMIT_PLACEHOLDER"
/// Build date in ISO 8601 format (embedded at build time)
public static let buildDate: String = "BUILD_DATE_PLACEHOLDER"
/// Whether this is a release build
public static let isRelease: Bool = {
!version.contains("-dirty") && !version.hasPrefix("unknown") && !version.hasPrefix("dev")
}()
/// Full version string with commit and build date
public static var fullVersion: String {
"\(version) (\(commit)) built on \(buildDate)"
}
/// Short version string (just the version)
public static var shortVersion: String {
version
}
}
EOF
# Replace placeholders with actual values
sed -i "s|VERSION_PLACEHOLDER|$VERSION|g" Sources/AROVersion/Version.swift
sed -i "s|COMMIT_PLACEHOLDER|$COMMIT|g" Sources/AROVersion/Version.swift
sed -i "s|BUILD_DATE_PLACEHOLDER|$BUILD_DATE|g" Sources/AROVersion/Version.swift
echo "Generated version file with:"
echo " Version: $VERSION"
echo " Commit: $COMMIT"
echo " Build Date: $BUILD_DATE"
# Release build with static Swift stdlib
- swift build -c release --static-swift-stdlib
- swift build -c release --product ARORuntime
# Verify CLI works
- .build/release/aro --help
- .build/release/aro check ./Examples/HelloWorldAPI
- .build/release/aro check ./Examples/UserService
# Prepare artifact directory
- mkdir -p aro-dist
- cp .build/release/aro aro-dist/
- cp .build/x86_64-unknown-linux-gnu/release/libARORuntime.a aro-dist/
# Show artifact contents
- ls -la aro-dist/
artifacts:
name: aro-linux-amd64
paths:
- aro-dist/
expire_in: 30 days
tags:
- spencer
# =============================================================================
# Integration Tests Stage
# =============================================================================
integration:linux:
stage: integration
image: ubuntu:22.04
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH =~ /^release\/.*/
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
needs:
- job: build:linux
artifacts: true
cache:
key: swift-integration
paths:
- /usr/share/swift/
policy: pull
before_script:
# Install dependencies
- apt-get update -qq
- export DEBIAN_FRONTEND=noninteractive
- apt-get install -y -qq git ca-certificates wget curl perl llvm-14 clang-14 cpanminus libipc-run-perl libyaml-libyaml-perl libhttp-tiny-perl zlib1g-dev libsqlite3-dev libxml2-dev libgit2-dev gnupg software-properties-common python3 build-essential
# Add LLVM APT repository for LLVM 20 (required for aro binary which links against libLLVM-20)
- wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
- echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" > /etc/apt/sources.list.d/llvm.list
- apt-get update -qq
- apt-get install -y -qq libllvm20 llvm-20 clang-20
# Setup LLVM 20 for both aro binary and llc/clang (V2 code generator produces LLVM 20 IR)
- ln -sf /usr/bin/llc-20 /usr/bin/llc
- ln -sf /usr/bin/clang-20 /usr/bin/clang
- export PATH="/usr/lib/llvm-20/bin:$PATH"
- export LD_LIBRARY_PATH="/usr/lib/llvm-20/lib:$LD_LIBRARY_PATH"
# Install Rust for plugin compilation
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- export PATH="$HOME/.cargo/bin:$PATH"
- rustc --version
# Install Swift for native compilation tests
- wget -q https://download.swift.org/swift-6.2.1-release/ubuntu2204/swift-6.2.1-RELEASE/swift-6.2.1-RELEASE-ubuntu22.04.tar.gz
- tar xzf swift-6.2.1-RELEASE-ubuntu22.04.tar.gz
- mv swift-6.2.1-RELEASE-ubuntu22.04 /usr/share/swift
- export PATH="/usr/share/swift/usr/bin:$PATH"
# Install Perl modules
- cpan -T Net::EmptyPort Term::ANSIColor 2>&1 || true
# Prepare ARO binary
- chmod +x ./aro-dist/aro
- export ARO_BIN="$CI_PROJECT_DIR/aro-dist/aro"
# Copy runtime library to system location
- mkdir -p /usr/local/lib
- cp ./aro-dist/libARORuntime.a /usr/local/lib/libARORuntime.a
# Verify installation
- ./aro-dist/aro --version
script:
- export PATH="$HOME/.cargo/bin:/usr/share/swift/usr/bin:/usr/lib/llvm-20/bin:$PATH"
- export LD_LIBRARY_PATH="/usr/lib/llvm-20/lib:$LD_LIBRARY_PATH"
- export ARO_BIN="$CI_PROJECT_DIR/aro-dist/aro"
# Debug: test aro build directly to see errors
- echo "=== Testing aro build directly ==="
- which clang && clang --version 2>&1 | head -1 || true
- which llc && llc --version 2>&1 | head -1 || true
- ls /usr/share/swift/usr/lib/swift/linux/ | head -5 || true
- echo "=== About to run aro build ==="
- ls -la ./aro-dist/aro || echo "aro binary not found"
- file ./aro-dist/aro || echo "file command failed"
- timeout 60 ./aro-dist/aro build ./Examples/HelloWorld --verbose 2>&1 || echo "Build failed with exit code $?"
- echo "=== aro build completed ==="
# Start local Open-Meteo stubs (offline HTTPClient / WeatherClient tests).
# Running them here, outside the test harness, avoids IPC::Run keeping
# pipes tied to backgrounded processes when a per-test pre-script exits.
- STUB_TIMEOUT=1800 nohup python3 Examples/HTTPClient/stub.py 18765 >/tmp/httpclient-stub.log 2>&1 </dev/null &
- STUB_TIMEOUT=1800 nohup python3 Examples/WeatherClient/stub.py 18766 >/tmp/weatherclient-stub.log 2>&1 </dev/null &
- for i in $(seq 1 50); do python3 -c 'import socket; s=socket.socket(); s.settimeout(0.2); exit(0 if s.connect_ex(("127.0.0.1",18765))==0 else 1)' && python3 -c 'import socket; s=socket.socket(); s.settimeout(0.2); exit(0 if s.connect_ex(("127.0.0.1",18766))==0 else 1)' && break; sleep 0.2; done
- python3 -c 'import urllib.request; print(urllib.request.urlopen("http://127.0.0.1:18765/v1/forecast").read()[:120])'
- python3 -c 'import urllib.request; print(urllib.request.urlopen("http://127.0.0.1:18766/v1/forecast").read()[:120])'
- chmod +x test-examples.pl
- perl test-examples.pl --verbose
artifacts:
when: on_failure
name: test-failures-linux
paths:
- Examples/**/expected.*
- Examples/**/testrun.*
- Examples/**/.build/*.ll
expire_in: 7 days
tags:
- spencer
integration:repl:
stage: integration
image: ubuntu:22.04
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH =~ /^release\/.*/
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
needs:
- job: build:linux
artifacts: true
before_script:
- apt-get update -qq
- export DEBIAN_FRONTEND=noninteractive
- apt-get install -y -qq wget gnupg software-properties-common perl libgit2-dev libcurl4
# Add LLVM APT repository for LLVM 20 (required for aro binary which links against libLLVM-20)
- wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
- echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" > /etc/apt/sources.list.d/llvm.list
- apt-get update -qq
- apt-get install -y -qq libllvm20
# Prepare ARO binary
- chmod +x ./aro-dist/aro
- export ARO_BIN="$CI_PROJECT_DIR/aro-dist/aro"
# Verify installation
- ./aro-dist/aro --version
script:
- export LD_LIBRARY_PATH="/usr/lib/llvm-20/lib:$LD_LIBRARY_PATH"
- export ARO_BIN="$CI_PROJECT_DIR/aro-dist/aro"
- chmod +x test_repl.pl
- perl test_repl.pl
tags:
- spencer
# =============================================================================
# Documentation Stage
# =============================================================================
documentation:
stage: documentation
image: ubuntu:22.04
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH =~ /^release\/.*/
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
needs:
- job: test
optional: true
before_script:
- apt-get update -qq
- export DEBIAN_FRONTEND=noninteractive
- apt-get install -y -qq pandoc weasyprint fonts-ibm-plex python3
script:
# Build Language Guide
- cd Book/TheLanguageGuide
- chmod +x build-pdf.sh
- ./build-pdf.sh
- cd ../..
# Build Construction Studies
- cd Book/TheConstructionStudies
- chmod +x build-pdf.sh
- ./build-pdf.sh
- cd ../..
# Build ARO By Example
- cd Book/AROByExample
- chmod +x build-pdf.sh
- ./build-pdf.sh
- cd ../..
# Build Essential Primer
- cd Book/TheEssentialPrimer
- chmod +x build-pdf.sh
- ./build-pdf.sh
artifacts:
name: aro-documentation
paths:
- Book/TheLanguageGuide/output/ARO-Language-Guide.pdf
- Book/TheConstructionStudies/output/ARO-Construction-Studies.pdf
- Book/AROByExample/output/ARO-By-Example.pdf
- Book/TheEssentialPrimer/output/ARO-Essential-Primer.pdf
expire_in: 30 days
tags:
- spencer
# =============================================================================
# Release Stage - Create GitLab Release (tags only)
# =============================================================================
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: build:linux
artifacts: true
- job: integration:linux
- job: documentation
artifacts: true
rules:
- if: $CI_COMMIT_TAG
before_script:
- apk add --no-cache tar gzip
script:
# Extract version from tag
- VERSION="${CI_COMMIT_TAG#v}"
- echo "Version - $VERSION"
# Package Linux binary
- cd aro-dist
- chmod +x aro
- tar -czvf ../aro-linux-amd64.tar.gz aro libARORuntime.a
- cd ..
# Show package contents
- ls -la aro-linux-amd64.tar.gz
- ls -la Book/TheLanguageGuide/output/ARO-Language-Guide.pdf || echo "Language Guide PDF not found"
- ls -la Book/TheConstructionStudies/output/ARO-Construction-Studies.pdf || echo "Construction Studies PDF not found"
- ls -la Book/AROByExample/output/ARO-By-Example.pdf || echo "ARO By Example PDF not found"
- ls -la Book/TheEssentialPrimer/output/ARO-Essential-Primer.pdf || echo "Essential Primer PDF not found"
# Determine if prerelease
- |
if echo "$CI_COMMIT_TAG" | grep -q '-'; then
echo "PRERELEASE=true" >> release.env
else
echo "PRERELEASE=false" >> release.env
fi
artifacts:
paths:
- aro-linux-amd64.tar.gz
- Book/TheLanguageGuide/output/ARO-Language-Guide.pdf
- Book/TheConstructionStudies/output/ARO-Construction-Studies.pdf
- Book/AROByExample/output/ARO-By-Example.pdf
- Book/TheEssentialPrimer/output/ARO-Essential-Primer.pdf
expire_in: 1 year
release:
tag_name: $CI_COMMIT_TAG
name: 'ARO ${CI_COMMIT_TAG#v}'
description: |
## ARO Programming Language ${CI_COMMIT_TAG#v}
### Downloads
| Platform | Architecture | Download |
|----------|--------------|----------|
| Linux | x86_64 | [aro-linux-amd64.tar.gz]($CI_PROJECT_URL/-/releases/$CI_COMMIT_TAG/downloads/aro-linux-amd64.tar.gz) |
### Documentation
| Document | Download |
|----------|----------|
| ARO Language Guide | [ARO-Language-Guide.pdf]($CI_PROJECT_URL/-/releases/$CI_COMMIT_TAG/downloads/ARO-Language-Guide.pdf) |
| ARO Construction Studies | [ARO-Construction-Studies.pdf]($CI_PROJECT_URL/-/releases/$CI_COMMIT_TAG/downloads/ARO-Construction-Studies.pdf) |
| ARO By Example | [ARO-By-Example.pdf]($CI_PROJECT_URL/-/releases/$CI_COMMIT_TAG/downloads/ARO-By-Example.pdf) |
| ARO Essential Primer | [ARO-Essential-Primer.pdf]($CI_PROJECT_URL/-/releases/$CI_COMMIT_TAG/downloads/ARO-Essential-Primer.pdf) |
### Installation
**Linux**
```bash
curl -L $CI_PROJECT_URL/-/releases/$CI_COMMIT_TAG/downloads/aro-linux-amd64.tar.gz | tar xz
sudo mv aro /usr/local/bin/
```
assets:
links:
- name: 'aro-linux-amd64.tar.gz'
url: '$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/aro-linux-amd64.tar.gz?job=release'
filepath: '/aro-linux-amd64.tar.gz'
link_type: 'package'
- name: 'ARO-Language-Guide.pdf'
url: '$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/Book/TheLanguageGuide/output/ARO-Language-Guide.pdf?job=release'
filepath: '/ARO-Language-Guide.pdf'
link_type: 'other'
- name: 'ARO-Construction-Studies.pdf'
url: '$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/Book/TheConstructionStudies/output/ARO-Construction-Studies.pdf?job=release'
filepath: '/ARO-Construction-Studies.pdf'
link_type: 'other'
- name: 'ARO-By-Example.pdf'
url: '$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/Book/AROByExample/output/ARO-By-Example.pdf?job=release'
filepath: '/ARO-By-Example.pdf'
link_type: 'other'
- name: 'ARO-Essential-Primer.pdf'
url: '$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/Book/TheEssentialPrimer/output/ARO-Essential-Primer.pdf?job=release'
filepath: '/ARO-Essential-Primer.pdf'
link_type: 'other'
tags:
- spencer
# =============================================================================
# Docker Stage - Build and Push Docker Images (using Kaniko + Crane)
# =============================================================================
docker:buildsystem:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.23.2-debug
entrypoint: [""]
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == "main"
variables:
IMAGE_NAME: $CI_REGISTRY_IMAGE/aro-buildsystem
before_script:
# Create Docker config for registry authentication
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD | base64 -w 0)\"}}}" > /kaniko/.docker/config.json
script:
# Determine tag
- |
if [ -n "$CI_COMMIT_TAG" ]; then
TAG="$CI_COMMIT_TAG"
DESTINATIONS="--destination=$IMAGE_NAME:$TAG --destination=$IMAGE_NAME:latest"
else
TAG="latest"
DESTINATIONS="--destination=$IMAGE_NAME:$TAG"
fi
# Build and push with Kaniko
- /kaniko/executor
--context=docker/buildsystem/
--dockerfile=docker/buildsystem/Dockerfile
--build-arg=ARO_VERSION=${CI_COMMIT_REF_NAME}
$DESTINATIONS
tags:
- spencer
docker:runtime:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.23.2-debug
entrypoint: [""]
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == "main"
variables:
IMAGE_NAME: $CI_REGISTRY_IMAGE/aro-runtime
before_script:
# Create Docker config for registry authentication
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD | base64 -w 0)\"}}}" > /kaniko/.docker/config.json
script:
# Determine tag
- |
if [ -n "$CI_COMMIT_TAG" ]; then
TAG="$CI_COMMIT_TAG"
DESTINATIONS="--destination=$IMAGE_NAME:$TAG --destination=$IMAGE_NAME:latest"
else
TAG="latest"
DESTINATIONS="--destination=$IMAGE_NAME:$TAG"
fi
# Build and push with Kaniko
- /kaniko/executor
--context=docker/runtime/
--dockerfile=docker/runtime/Dockerfile
$DESTINATIONS
tags:
- spencer
# =============================================================================
# Mastodon Stage - Post Daily Cards (scheduled pipelines only)
# =============================================================================
post:mastodon:
stage: mastodon
image: node:20-bookworm
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
before_script:
# Install Puppeteer dependencies for card generation
- apt-get update -qq
- apt-get install -y -qq chromium
- export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
- export PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
script:
- cd cards
- npm install
- node generate.js
- node post-to-mastodon.js
tags:
- spencer