more updates
This commit is contained in:
@@ -25,6 +25,9 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build and push kforge action image
|
- name: Build and push kforge action image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ func writeDeployJobs(b *strings.Builder, cfg *config.KforgeConfig, opts GiteaAct
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeStep(b, "Set up Docker Buildx", map[string]any{
|
||||||
|
"uses": "docker/setup-buildx-action@v3",
|
||||||
|
})
|
||||||
|
|
||||||
fullRepo := cfg.Registry.URL + "/" + cfg.Meta.Tenant + "/" + cfg.Meta.Name
|
fullRepo := cfg.Registry.URL + "/" + cfg.Meta.Tenant + "/" + cfg.Meta.Name
|
||||||
buildWith := map[string]any{
|
buildWith := map[string]any{
|
||||||
"context": ".",
|
"context": ".",
|
||||||
@@ -241,8 +245,10 @@ func GeneratePreviewActions(cfg *config.KforgeConfig) (string, error) {
|
|||||||
fmt.Fprintf(&b, "# Generated by kforge — do not edit manually.\n")
|
fmt.Fprintf(&b, "# Generated by kforge — do not edit manually.\n")
|
||||||
fmt.Fprintf(&b, "# Re-generate: kforge gitea-preview > .gitea/workflows/preview.yml\n")
|
fmt.Fprintf(&b, "# Re-generate: kforge gitea-preview > .gitea/workflows/preview.yml\n")
|
||||||
fmt.Fprintf(&b, "#\n")
|
fmt.Fprintf(&b, "#\n")
|
||||||
fmt.Fprintf(&b, "# Required secrets (same as deploy workflow):\n")
|
fmt.Fprintf(&b, "# Required secrets:\n")
|
||||||
fmt.Fprintf(&b, "# DOCKER_USERNAME, DOCKER_PASSWORD\n")
|
if !cfg.Registry.Insecure {
|
||||||
|
fmt.Fprintf(&b, "# DOCKER_USERNAME, DOCKER_PASSWORD (registry auth)\n")
|
||||||
|
}
|
||||||
fmt.Fprintf(&b, "# KFORGE_NODE_IP, KUBE_HOST, KUBE_TOKEN, KUBE_CERTIFICATE\n")
|
fmt.Fprintf(&b, "# KFORGE_NODE_IP, KUBE_HOST, KUBE_TOKEN, KUBE_CERTIFICATE\n")
|
||||||
fmt.Fprintf(&b, "\n")
|
fmt.Fprintf(&b, "\n")
|
||||||
fmt.Fprintf(&b, "name: Preview Environment\n")
|
fmt.Fprintf(&b, "name: Preview Environment\n")
|
||||||
@@ -261,6 +267,7 @@ func GeneratePreviewActions(cfg *config.KforgeConfig) (string, error) {
|
|||||||
"with": map[string]any{"fetch-depth": 0},
|
"with": map[string]any{"fetch-depth": 0},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if !cfg.Registry.Insecure {
|
||||||
writeStep(&b, "Login to registry", map[string]any{
|
writeStep(&b, "Login to registry", map[string]any{
|
||||||
"if": "${{ github.event.action != 'closed' }}",
|
"if": "${{ github.event.action != 'closed' }}",
|
||||||
"uses": "docker/login-action@v2",
|
"uses": "docker/login-action@v2",
|
||||||
@@ -270,11 +277,14 @@ func GeneratePreviewActions(cfg *config.KforgeConfig) (string, error) {
|
|||||||
"password": "${{ secrets.DOCKER_PASSWORD }}",
|
"password": "${{ secrets.DOCKER_PASSWORD }}",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
writeStep(&b, "Build and push preview image", map[string]any{
|
writeStep(&b, "Set up Docker Buildx", map[string]any{
|
||||||
"if": "${{ github.event.action != 'closed' }}",
|
"if": "${{ github.event.action != 'closed' }}",
|
||||||
"uses": "docker/build-push-action@v5",
|
"uses": "docker/setup-buildx-action@v3",
|
||||||
"with": map[string]any{
|
})
|
||||||
|
|
||||||
|
previewBuildWith := map[string]any{
|
||||||
"context": ".",
|
"context": ".",
|
||||||
"platforms": "linux/amd64",
|
"platforms": "linux/amd64",
|
||||||
"file": cfg.Defaults.Dockerfile,
|
"file": cfg.Defaults.Dockerfile,
|
||||||
@@ -282,7 +292,17 @@ func GeneratePreviewActions(cfg *config.KforgeConfig) (string, error) {
|
|||||||
"tags": fmt.Sprintf("%s:pr-${{ github.event.number }}", fullRepo),
|
"tags": fmt.Sprintf("%s:pr-${{ github.event.number }}", fullRepo),
|
||||||
"provenance": false,
|
"provenance": false,
|
||||||
"sbom": false,
|
"sbom": false,
|
||||||
},
|
}
|
||||||
|
if cfg.Registry.Insecure {
|
||||||
|
previewBuildWith["buildkitd-config-inline"] = fmt.Sprintf(
|
||||||
|
"[registry.%q]\n http = true\n insecure = true",
|
||||||
|
cfg.Registry.URL,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
writeStep(&b, "Build and push preview image", map[string]any{
|
||||||
|
"if": "${{ github.event.action != 'closed' }}",
|
||||||
|
"uses": "docker/build-push-action@v5",
|
||||||
|
"with": previewBuildWith,
|
||||||
})
|
})
|
||||||
|
|
||||||
if cfg.ActionRef != "" {
|
if cfg.ActionRef != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user