Open bdnf opened 3 years ago
Describe the bug/feature
jsonnet
$KAPITAN_VAR_some_variable
kapitan compile
Could not find ref backend for tag: ?{env:some_variable} Compile error: failed to compile target: microservice
To Reproduce Steps to reproduce the behavior:
Assuming simple folder structure:
├── components | └── test-component.jsonnet └── inventory └── classes | └── base.yml └── targets └── microserviceyml
Contents of components/test-component.jsonnet:
local kap = import 'lib/kapitan.libjsonnet'; local inventory = kap.inventory();
local TOPIC = inventory.parameters.arguments.topic; local database = std.asciiLower(inventory.parameters.arguments.mysql);
{ 'job': { apiVersion: 'batch/v1', kind: 'Job', metadata: { labels: { database: database, topic: std.asciiLower(TOPIC), deployment_name: inventory.parameters.deployment_name, }, name: database + '-' + std.asciiLower(TOPIC), }, spec: {} } }
3. Contents of *inventory/classes/base.yaml*: ```yaml parameters: arguments: mysql: ?{env:database} topic: ?{env:topic} kapitan: compile: - output_path: ./${arguments:topic}/ input_type: jsonnet output_type: json prune: True input_paths: - components/test-component.jsonnet
classes: - base
parameters: deployment_name: dev target_namespace: default
commit_tag: 1223456789
kapitan: vars: target: microservice
5. Set the reference of type **env*: ```bash export KAPITAN_VAR_database="sql.server:port/test_db" export KAPITAN_VAR_topic="starting_offsets.TIER1" # set defaults echo -n "some-db-name" | kapitan refs --write env:database -t microservice -f - echo -n "some-topic-name" | kapitan refs --write env:topic -t microservice -f -
kapitan compile -t microservice Compiled microservice (0.04s)
And generated file is:
{ "apiVersion": "batch/v1", "kind": "Job", "metadata": { "labels": { "database": "?{env:database:e1220f11}", "deployment_name": "dev", "topic": "?{env:topic:19fc3d6e}" }, "name": "?{env:database:e1220f11}-?{env:topic:19fc3d6e}" } }
Expected behavior Compiled successfully and compiled file to be compiled/microservice/job.json with contents:
{ "apiVersion": "batch/v1", "kind": "Job", "metadata": { "labels": { "database": "sql.server:port/test_db", "deployment_name": "dev", "topic": "starting_offsets.TIER1" }, "name": "sql.server:port/test_db-starting_offsets.TIER1" } }
Possible Bug
kapitan --version
python --version
pip3 --version
pyenv
Try kapitan compile --reveal
kapitan compile --reveal
This issue is stale because it has been open for 1 year with no activity. Remove the stale label or comment if this issue is still relevant for you. If not, please close it yourself.
Describe the bug/feature
jsonnet
files are compiled.$KAPITAN_VAR_some_variable
is set, thenkapitan compile
fails with:To Reproduce Steps to reproduce the behavior:
Assuming simple folder structure:
Contents of components/test-component.jsonnet:
local TOPIC = inventory.parameters.arguments.topic; local database = std.asciiLower(inventory.parameters.arguments.mysql);
{ 'job': { apiVersion: 'batch/v1', kind: 'Job', metadata: { labels: { database: database, topic: std.asciiLower(TOPIC), deployment_name: inventory.parameters.deployment_name, }, name: database + '-' + std.asciiLower(TOPIC), }, spec: {} } }
parameters: deployment_name: dev target_namespace: default
commit_tag: 1223456789
kapitan: vars: target: microservice
And generated file is:
Expected behavior Compiled successfully and compiled file to be compiled/microservice/job.json with contents:
Possible Bug
kapitan --version
: 0.29.5python --version
: Python 3.7.11pip3 --version
: pip 21.2.2 from /opt/venv/lib/python3.7/site-packages/pip (python 3.7)pyenv