From 59b3c433a9c29f5900ccadde49e2de74c91974a1 Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Thu, 12 Dec 2024 17:52:02 -0500 Subject: [PATCH] refac(back): #1378 deprecate deploy nomad - Deprecate deploy nomad as we do not use it - Remove documentation Signed-off-by: Daniel Salazar --- docs/src/api/builtins/deploy.md | 79 ------------------- src/args/agnostic.nix | 1 - src/args/deploy-nomad/default.nix | 13 --- src/args/deploy-nomad/entrypoint.sh | 18 ----- src/evaluator/modules/default.nix | 1 - .../modules/deploy-nomad/default.nix | 64 --------------- 6 files changed, 176 deletions(-) delete mode 100644 src/args/deploy-nomad/default.nix delete mode 100644 src/args/deploy-nomad/entrypoint.sh delete mode 100644 src/evaluator/modules/deploy-nomad/default.nix diff --git a/docs/src/api/builtins/deploy.md b/docs/src/api/builtins/deploy.md index 99a4fcb5..bfb34db6 100644 --- a/docs/src/api/builtins/deploy.md +++ b/docs/src/api/builtins/deploy.md @@ -420,84 +420,5 @@ Example: m . /taintTerraform/module ``` -## deployNomad - -Deploy [Nomad](https://www.nomad.io/) code -by performing a `nomad plan` -over the specified Nomad jobs / namespaces. - -Types: - -- deployNomad: - - jobs (`attrsOf jobsType`): Optional. - Path to Nomad jobs to deploy. - Defaults to `{ }`. - - namespaces (`attrsOf namespacesType`): Optional. - Path to Nomad namespaces to deploy. - Defaults to `{ }`. -- jobsType (`submodule`): - - setup (`listOf package`): Optional. - [Makes Environment][makes_environment] - or [Makes Secrets][makes_secrets] - to `source` (as in Bash's `source`) - before anything else. - Defaults to `[ ]`. - - src (`path`): - Path to the Nomad job (hcl or json). - - version (`enum [ "1.0" "1.1" ]`): - Nomad version your job is built with. - Defaults to `"1.1"`. - - namespace (`str`): - Nomad namespace to deploy the job into. -- namespacesType (`submodule`): - - setup (`listOf package`): Optional. - Makes Environment - or Makes Secrets - to `source` (as in Bash's `source`) - before anything else. - Defaults to `[ ]`. - - jobs (`attrOf path`): - Attributes of path to the Nomad jobs (hcl or json). - - version (`enum [ "1.0" "1.1" ]`): - Nomad version your jobs are built with. - Defaults to `"1.1"`. - -Example: - -=== "makes.nix" - - ```nix - { - deployNomad = { - jobs = { - job1 = { - src = ./my/job1.hcl; - namespace = "default"; - }; - job2 = { - src = ./my/job2.json; - namespace = "default"; - }; - }; - namespaces = { - dev.jobs = { - job1 = ./my/dev/job1.hcl; - job2 = ./my/dev/job2.json; - }; - staging.jobs = { - job1 = ./my/staging/job1.hcl; - job2 = ./my/staging/job2.json; - }; - }; - }; - } - ``` - -=== "Invocation" - - ```bash - m . /deployNomad/default/job1 - ``` - [makes_environment]: ./environment.md [makes_secrets]: ./secrets.md diff --git a/src/args/agnostic.nix b/src/args/agnostic.nix index 2e13766f..74a086d7 100644 --- a/src/args/agnostic.nix +++ b/src/args/agnostic.nix @@ -32,7 +32,6 @@ let deployContainer = import ./deploy-container/default.nix self; deployContainerManifest = import ./deploy-container-manifest/default.nix self; - deployNomad = import ./deploy-nomad/default.nix self; deployTerraform = import ./deploy-terraform/default.nix self; inherit (__nixpkgs__.lib.strings) escapeShellArg; inherit (__nixpkgs__.lib.strings) escapeShellArgs; diff --git a/src/args/deploy-nomad/default.nix b/src/args/deploy-nomad/default.nix deleted file mode 100644 index 2b58f8c1..00000000 --- a/src/args/deploy-nomad/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ makeScript, makeNomadEnvironment, ... }: -{ setup, name, version, src, namespace, }: -makeScript { - entrypoint = ./entrypoint.sh; - replace = { - __argSrc__ = src; - __argNamespace__ = namespace; - }; - name = "deploy-nomad-for-${name}"; - searchPaths = { - source = [ (makeNomadEnvironment { inherit version; }) ] ++ setup; - }; -} diff --git a/src/args/deploy-nomad/entrypoint.sh b/src/args/deploy-nomad/entrypoint.sh deleted file mode 100644 index 8ab7aac5..00000000 --- a/src/args/deploy-nomad/entrypoint.sh +++ /dev/null @@ -1,18 +0,0 @@ -# shellcheck shell=bash - -function main { - local args=( - -namespace='__argNamespace__' - ) - local src='__argSrc__' - - if running_in_ci_cd_provider; then - info Applying "${src}" - nomad job run "${args[@]}" "${src}" - else - info Planning "${src}" - nomad job plan "${args[@]}" "${src}" - fi -} - -main "${@}" diff --git a/src/evaluator/modules/default.nix b/src/evaluator/modules/default.nix index b084fe7d..0ad5f35b 100644 --- a/src/evaluator/modules/default.nix +++ b/src/evaluator/modules/default.nix @@ -6,7 +6,6 @@ (import ./dev/default.nix args) (import ./deploy-container/default.nix args) (import ./deploy-container-manifest/default.nix args) - (import ./deploy-nomad/default.nix args) (import ./deploy-terraform/default.nix args) (import ./dynamodb/default.nix args) (import ./env-vars/default.nix args) diff --git a/src/evaluator/modules/deploy-nomad/default.nix b/src/evaluator/modules/deploy-nomad/default.nix deleted file mode 100644 index 64e10da3..00000000 --- a/src/evaluator/modules/deploy-nomad/default.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ __nixpkgs__, __toModuleOutputs__, deployNomad, attrsMerge, attrsMapToList, ... -}: -{ config, lib, ... }: -let - makeNamespaceOutput = namespace: - { setup, jobs, version, }: - attrsMapToList makeJobOutput (lib.mapAttrs (_: src: { - inherit setup; - inherit version; - inherit namespace; - inherit src; - }) jobs); - makeJobOutput = name: - { setup, src, namespace, version, }: { - name = "/deployNomad/${namespace}/${name}"; - value = deployNomad { - inherit setup; - inherit name; - inherit src; - inherit namespace; - inherit version; - }; - }; - setupOpt = lib.mkOption { - default = [ ]; - type = lib.types.listOf lib.types.package; - }; - versionOpt = lib.mkOption { - type = lib.types.enum [ "1.0" "1.1" ]; - default = "1.1"; - }; -in { - options = { - deployNomad = { - jobs = lib.mkOption { - default = { }; - type = lib.types.attrsOf (lib.types.submodule (_: { - options = { - setup = setupOpt; - src = lib.mkOption { type = lib.types.path; }; - namespace = lib.mkOption { type = lib.types.str; }; - version = versionOpt; - }; - })); - }; - namespaces = lib.mkOption { - default = { }; - type = lib.types.attrsOf (lib.types.submodule (_: { - options = { - setup = setupOpt; - jobs = lib.mkOption { type = lib.types.attrsOf lib.types.path; }; - version = versionOpt; - }; - })); - }; - }; - }; - config = { - outputs = attrsMerge [ - (__toModuleOutputs__ makeNamespaceOutput config.deployNomad.namespaces) - (__toModuleOutputs__ makeJobOutput config.deployNomad.jobs) - ]; - }; -}