From 15aff39144a81602735e58dd6773171071ffb5df Mon Sep 17 00:00:00 2001 From: Shikanime Deva Date: Fri, 28 Aug 2026 21:33:04 +0200 Subject: [PATCH 1/2] Fix skaffold Flux OCI push repository value under YAML folding Signed-off-by: Shikanime Deva Change-Id: I7a23c6307b2e57293fac2e9b115db0546a6a6964 --- .../devenv/integrations/github/skaffold.nix | 59 +++++++++++++++++++ modules/devenv/profiles/skaffold.nix | 5 +- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/modules/devenv/integrations/github/skaffold.nix b/modules/devenv/integrations/github/skaffold.nix index 7967699..4e44015 100644 --- a/modules/devenv/integrations/github/skaffold.nix +++ b/modules/devenv/integrations/github/skaffold.nix @@ -11,6 +11,24 @@ let yamlFormat = pkgs.formats.yaml { }; githubToken = "\${{ steps.createGithubAppToken.outputs.token || secrets.GITHUB_TOKEN }}"; + + # Derives owner/repo + the Flux OCI repository URL from GITHUB_REPOSITORY so it + # works under every trigger type (workflow_call does not populate + # github.event.repository.name). `matrixNameExpr` is the GitHub expression for + # the profile name, or null for the default (repo-named) manifest. + repoStep = matrixNameExpr: { + id = "repo"; + shell = "bash"; + env = lib.optionalAttrs (matrixNameExpr != null) { MATRIX_NAME = matrixNameExpr; }; + run = '' + owner=''${GITHUB_REPOSITORY%%/*} + name=''${GITHUB_REPOSITORY##*/} + echo "owner=$owner" >> "$GITHUB_OUTPUT" + echo "name=$name" >> "$GITHUB_OUTPUT" + manifest_repo=''${MATRIX_NAME:-$name} + echo "repository=ghcr.io/$owner/$name/manifests/$manifest_repo" >> "$GITHUB_OUTPUT" + ''; + }; in { options.github.workflows.skaffold = { @@ -48,6 +66,12 @@ in description = "Overrides for skaffold integration"; }; + flux-push = mkOption { + type = types.submodule { freeformType = yamlFormat.type; }; + default = { }; + description = "Overrides for the Flux OCI push of rendered manifests (repository is derived automatically)"; + }; + otel-endpoint = mkOption { type = types.str; default = ""; @@ -146,6 +170,7 @@ in } // cfg.settings.checkout; } + (repoStep null) { uses = "docker/login-action@v4"; "with" = { @@ -197,6 +222,17 @@ in path = "artifacts/skaffold-manifest.yaml"; }; } + { + id = "flux-push"; + "if" = "\${{ inputs.push }}"; + uses = "shikanime-labs/actions/flux/flux-push@v9"; + env = "\${{ fromJSON(steps.direnv.outputs.env) }}"; + "with" = { + path = "artifacts/skaffold-manifest.yaml"; + repository = "\${{ steps.repo.outputs.repository }}"; + } + // cfg.settings.flux-push; + } ]; }; @@ -232,6 +268,7 @@ in } // cfg.settings.checkout; } + (repoStep "\${{ matrix.name }}") { uses = "docker/login-action@v4"; "with" = { @@ -263,6 +300,28 @@ in } // optionalAttrs (cfg.settings.integration != { }) cfg.settings.integration; } + { + name = "Save manifest"; + env.SKAFFOLD_MANIFEST = "\${{ steps.skaffold.outputs.manifest }}"; + run = '' + mkdir -p artifacts + cat > artifacts/skaffold-manifest.yaml <<'MANIFEST_EOF' + $SKAFFOLD_MANIFEST + MANIFEST_EOF + ''; + shell = "bash"; + } + { + id = "flux-push"; + "if" = "\${{ inputs.push }}"; + uses = "shikanime-labs/actions/flux/flux-push@v9"; + env = "\${{ fromJSON(steps.direnv.outputs.env) }}"; + "with" = { + path = "artifacts/skaffold-manifest.yaml"; + repository = "\${{ steps.repo.outputs.repository }}"; + } + // cfg.settings.flux-push; + } ]; }; }; diff --git a/modules/devenv/profiles/skaffold.nix b/modules/devenv/profiles/skaffold.nix index 1e6c354..0ae0cc2 100644 --- a/modules/devenv/profiles/skaffold.nix +++ b/modules/devenv/profiles/skaffold.nix @@ -13,5 +13,8 @@ github.workflows.skaffold.enable = true; - packages = [ pkgs.skaffold ]; + packages = [ + pkgs.skaffold + pkgs.fluxcd + ]; } From e5d4afe44219ac647102dbc8186dfbeaf8044cbc Mon Sep 17 00:00:00 2001 From: Shikanime Deva Date: Sat, 29 Aug 2026 16:55:28 +0200 Subject: [PATCH 2/2] Remove dead direnv env reference and inline repo step The flux-push step referenced steps.direnv.outputs.env, but the direnv action writes to $GITHUB_ENV and exposes no outputs block, so the reference was always empty. Remove it and inline the repo derivation step that was previously factored into a repoStep helper. Related: https://github.com/shikanime-labs/devlib/issues/401 Signed-off-by: Shikanime Deva --- .../devenv/integrations/github/skaffold.nix | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/modules/devenv/integrations/github/skaffold.nix b/modules/devenv/integrations/github/skaffold.nix index 4e44015..cc6feb1 100644 --- a/modules/devenv/integrations/github/skaffold.nix +++ b/modules/devenv/integrations/github/skaffold.nix @@ -11,24 +11,6 @@ let yamlFormat = pkgs.formats.yaml { }; githubToken = "\${{ steps.createGithubAppToken.outputs.token || secrets.GITHUB_TOKEN }}"; - - # Derives owner/repo + the Flux OCI repository URL from GITHUB_REPOSITORY so it - # works under every trigger type (workflow_call does not populate - # github.event.repository.name). `matrixNameExpr` is the GitHub expression for - # the profile name, or null for the default (repo-named) manifest. - repoStep = matrixNameExpr: { - id = "repo"; - shell = "bash"; - env = lib.optionalAttrs (matrixNameExpr != null) { MATRIX_NAME = matrixNameExpr; }; - run = '' - owner=''${GITHUB_REPOSITORY%%/*} - name=''${GITHUB_REPOSITORY##*/} - echo "owner=$owner" >> "$GITHUB_OUTPUT" - echo "name=$name" >> "$GITHUB_OUTPUT" - manifest_repo=''${MATRIX_NAME:-$name} - echo "repository=ghcr.io/$owner/$name/manifests/$manifest_repo" >> "$GITHUB_OUTPUT" - ''; - }; in { options.github.workflows.skaffold = { @@ -170,8 +152,18 @@ in } // cfg.settings.checkout; } - (repoStep null) { + id = "repo"; + shell = "bash"; + run = '' + owner=''${GITHUB_REPOSITORY%%/*} + name=''${GITHUB_REPOSITORY##*/} + echo "owner=$owner" >> "$GITHUB_OUTPUT" + echo "name=$name" >> "$GITHUB_OUTPUT" + echo "repository=ghcr.io/$owner/$name/manifests/$name" >> "$GITHUB_OUTPUT" + ''; + } +{ uses = "docker/login-action@v4"; "with" = { registry = "ghcr.io"; @@ -226,7 +218,6 @@ in id = "flux-push"; "if" = "\${{ inputs.push }}"; uses = "shikanime-labs/actions/flux/flux-push@v9"; - env = "\${{ fromJSON(steps.direnv.outputs.env) }}"; "with" = { path = "artifacts/skaffold-manifest.yaml"; repository = "\${{ steps.repo.outputs.repository }}"; @@ -268,8 +259,20 @@ in } // cfg.settings.checkout; } - (repoStep "\${{ matrix.name }}") { + id = "repo"; + shell = "bash"; + env.matrix_name = "\${{ matrix.name }}"; + run = '' + owner=''${GITHUB_REPOSITORY%%/*} + name=''${GITHUB_REPOSITORY##*/} + echo "owner=$owner" >> "$GITHUB_OUTPUT" + echo "name=$name" >> "$GITHUB_OUTPUT" + manifest_repo=''${matrix_name:-$name} + echo "repository=ghcr.io/$owner/$name/manifests/$manifest_repo" >> "$GITHUB_OUTPUT" + ''; + } +{ uses = "docker/login-action@v4"; "with" = { registry = "ghcr.io"; @@ -315,7 +318,6 @@ in id = "flux-push"; "if" = "\${{ inputs.push }}"; uses = "shikanime-labs/actions/flux/flux-push@v9"; - env = "\${{ fromJSON(steps.direnv.outputs.env) }}"; "with" = { path = "artifacts/skaffold-manifest.yaml"; repository = "\${{ steps.repo.outputs.repository }}";