Skip to content

Commit fe6f6d9

Browse files
committed
[SPARK-52374] Publish apache/spark-connect-swift:web docker image
### What changes were proposed in this pull request? This PR aims to update and publish `apache/spark-connect-swift:web` docker image. ### Why are the changes needed? To provide a working long-running example in addition to the previous `pi` example. Note that currently `pi` example is used in both `Spark Connect Swift` and `Spark K8s Operator` website as K8s `Job` usage. - https://apache.github.io/spark-connect-swift/ - https://apache.github.io/spark-kubernetes-operator/ ### Does this PR introduce _any_ user-facing change? No behavior change. ### How was this patch tested? Manual review. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #192 from dongjoon-hyun/SPARK-52374. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent b90002f commit fe6f6d9

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

.github/workflows/publish_image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
description: 'list of examples to publish (JSON)'
88
required: true
99
# keep in sync with default value of strategy matrix 'example'
10-
default: '["pi"]'
10+
default: '["pi", "web"]'
1111

1212
jobs:
1313
publish-image:
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
# keep in sync with default value of workflow_dispatch input 'example'
20-
example: ${{ fromJSON( inputs.example || '["pi"]' ) }}
20+
example: ${{ fromJSON( inputs.example || '["pi", "web"]' ) }}
2121
steps:
2222
- name: Set up QEMU
2323
uses: docker/setup-qemu-action@v3

Examples/web/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let package = Package(
2626
],
2727
dependencies: [
2828
// 💧 A server-side Swift web framework.
29-
.package(url: "https://github.com/vapor/vapor.git", from: "4.110.1"),
29+
.package(url: "https://github.com/vapor/vapor.git", from: "4.115.0"),
3030
// 🔵 Non-blocking, event-driven networking for Swift. Used for custom executors
3131
.package(url: "https://github.com/apple/swift-nio.git", from: "2.65.0"),
3232
.package(url: "https://github.com/apache/spark-connect-swift.git", branch: "main"),

Examples/web/README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ vapor new spark-connect-swift-web -n
1616
```bash
1717
$ git diff HEAD
1818
diff --git a/Package.swift b/Package.swift
19-
index 477bcbd..3e7bb06 100644
19+
index 2edcc8f..dd918a9 100644
2020
--- a/Package.swift
2121
+++ b/Package.swift
2222
@@ -4,13 +4,14 @@ import PackageDescription
@@ -28,7 +28,7 @@ index 477bcbd..3e7bb06 100644
2828
],
2929
dependencies: [
3030
// 💧 A server-side Swift web framework.
31-
.package(url: "https://github.com/vapor/vapor.git", from: "4.110.1"),
31+
.package(url: "https://github.com/vapor/vapor.git", from: "4.115.0"),
3232
// 🔵 Non-blocking, event-driven networking for Swift. Used for custom executors
3333
.package(url: "https://github.com/apple/swift-nio.git", from: "2.65.0"),
3434
+ .package(url: "https://github.com/apache/spark-connect-swift.git", branch: "main"),
@@ -43,17 +43,30 @@ index 477bcbd..3e7bb06 100644
4343
],
4444
swiftSettings: swiftSettings
4545
),
46-
diff --git a/Sources/SparkConnectSwiftWebapp/routes.swift b/Sources/SparkConnectSwiftWebapp/routes.swift
47-
index 2edcc8f..22313c8 100644
48-
--- a/Sources/SparkConnectSwiftWebapp/routes.swift
49-
+++ b/Sources/SparkConnectSwiftWebapp/routes.swift
50-
@@ -1,4 +1,5 @@
46+
diff --git a/Sources/SparkConnectSwiftWeb/configure.swift b/Sources/SparkConnectSwiftWeb/configure.swift
47+
index 7715d7c..eea2f95 100644
48+
--- a/Sources/SparkConnectSwiftWeb/configure.swift
49+
+++ b/Sources/SparkConnectSwiftWeb/configure.swift
50+
@@ -2,6 +2,7 @@ import Vapor
51+
52+
// configures your application
53+
public func configure(_ app: Application) async throws {
54+
+ app.http.server.configuration.hostname = "0.0.0.0"
55+
// uncomment to serve files from /Public folder
56+
// app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
57+
58+
diff --git a/Sources/SparkConnectSwiftWeb/routes.swift b/Sources/SparkConnectSwiftWeb/routes.swift
59+
index 2edcc8f..dd918a9 100644
60+
--- a/Sources/SparkConnectSwiftWeb/routes.swift
61+
+++ b/Sources/SparkConnectSwiftWeb/routes.swift
62+
@@ -1,11 +1,21 @@
5163
import Vapor
5264
+import SparkConnect
5365

5466
func routes(_ app: Application) throws {
5567
app.get { req async in
56-
@@ -6,6 +7,15 @@ func routes(_ app: Application) throws {
68+
- "It works!"
69+
+ "Welcome to the Swift world. Say hello!"
5770
}
5871

5972
app.get("hello") { req async -> String in

0 commit comments

Comments
 (0)