Skip to content

Commit 11f8f5c

Browse files
authored
feat(init): remove preset pipeline downloader (#970)
Because - We are refactoring the preset pipeline mechanism. The preset pipeline will now be created programmatically by other services instead of being downloaded via the preset pipeline downloader. For example, the preset pipelines used by artifact-backend will be created by artifact-backend itself. This commit - Removes the preset pipeline downloader. - Adjusts pipeline release creation.
1 parent ac3e2c3 commit 11f8f5c

File tree

9 files changed

+28
-328
lines changed

9 files changed

+28
-328
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ RUN apt update && \
7373
chromium \
7474
qpdf && \
7575
python3 -m venv /opt/venv && \
76-
/opt/venv/bin/pip install pdfplumber mistral-common tokenizers docling && \
76+
/opt/venv/bin/pip install pdfplumber mistral-common tokenizers docling==2.18.0 && \
7777
rm -rf /var/lib/apt/lists/*
7878

7979
# Copy FFmpeg from build stage

Dockerfile.dev

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ RUN apt update && \
3131
chromium \
3232
qpdf && \
3333
python3 -m venv /opt/venv && \
34-
/opt/venv/bin/pip install pdfplumber mistral-common tokenizers docling && \
34+
/opt/venv/bin/pip install pdfplumber mistral-common tokenizers docling==2.18.0 && \
3535
rm -rf /var/lib/apt/lists/*
3636

3737
# Install FFmpeg Static Build

cmd/init/main.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"go.opentelemetry.io/otel"
99

1010
"github.com/instill-ai/pipeline-backend/cmd/init/definitionupdater"
11-
"github.com/instill-ai/pipeline-backend/cmd/init/presetdownloader"
11+
1212
"github.com/instill-ai/pipeline-backend/config"
1313
"github.com/instill-ai/pipeline-backend/pkg/repository"
1414

@@ -39,8 +39,5 @@ func main() {
3939
if err := definitionupdater.UpdateComponentDefinitionIndex(ctx, repo); err != nil {
4040
log.Fatal(err)
4141
}
42-
if err := presetdownloader.DownloadPresetPipelines(ctx, repo); err != nil {
43-
log.Fatal(err)
44-
}
4542

4643
}

cmd/init/presetdownloader/downloader.go

-292
This file was deleted.

pkg/acl/acl.go

+6
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,12 @@ func (c *ACLClient) CheckLinkPermission(ctx context.Context, objectType string,
311311

312312
// CheckPermission returns the access of the context user over a resource.
313313
func (c *ACLClient) CheckPermission(ctx context.Context, objectType string, objectUID uuid.UUID, role string) (bool, error) {
314+
315+
serviceType := resource.GetRequestSingleHeader(ctx, constant.HeaderServiceKey)
316+
if serviceType == "instill" {
317+
return true, nil
318+
}
319+
314320
userType := resource.GetRequestSingleHeader(ctx, constant.HeaderAuthTypeKey)
315321

316322
var userUID string

pkg/constant/constant.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,18 @@ const (
2626
HeaderVisitorUIDKey = "Instill-Visitor-Uid"
2727
// HeaderAuthTypeKey is the context key the authentication type (user or
2828
// visitor).
29-
HeaderAuthTypeKey = "Instill-Auth-Type"
30-
29+
HeaderAuthTypeKey = "Instill-Auth-Type"
3130
HeaderInstillCodeKey = "Instill-Share-Code"
3231
HeaderReturnTracesKey = "Instill-Return-Traces"
3332

33+
// HeaderServiceKey is the context key for service-to-service communication.
34+
// When present, it indicates the request originates from an internal
35+
// service rather than an end user. Valid values are restricted to "instill"
36+
// and can only be set by internal services. Requests with this header
37+
// bypass standard authorization checks since they represent trusted
38+
// internal traffic.
39+
HeaderServiceKey = "Instill-Service"
40+
3441
HeaderUserAgentKey = "Instill-User-Agent"
3542

3643
HeaderAccept = "Accept"

pkg/handler/utils.go

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import (
99
)
1010

1111
func authenticateUser(ctx context.Context, allowVisitor bool) error {
12+
if resource.GetRequestSingleHeader(ctx, constant.HeaderServiceKey) == "instill" {
13+
return nil
14+
}
15+
1216
if resource.GetRequestSingleHeader(ctx, constant.HeaderAuthTypeKey) == "user" {
1317
if resource.GetRequestSingleHeader(ctx, constant.HeaderUserUIDKey) == "" {
1418
return service.ErrUnauthenticated

0 commit comments

Comments
 (0)