Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add build tag to enable libjq-go explicitly #440

Merged
merged 1 commit into from
Dec 1, 2022

Conversation

diafour
Copy link
Contributor

@diafour diafour commented Nov 28, 2022

Overview

  • use jq binary by default to simplify local setup and testing
  • build tag 'use_libjq' should be used to build shell-operator with libjq-go
  • add debug message with jqFilter implementation details

What this PR does / why we need it

libjq-go is somewhat hard to install when you want just run tests on new PR.

Results

# CGO_ENABLED=1 is by default, jq binary is used now.
$ go build ./cmd/shell-operator                                                                  
$ LOG_LEVEL=Debug ./shell-operator
time="2022-11-28T10:22:47+03:00" level=debug msg="Use jq binary for jqFilter"

# jq binary will be used if CGO_ENABLED=0, as before.
$ CGO_ENABLED=0 go build ./cmd/shell-operator
$ LOG_LEVEL=Debug ./shell-operator            
time="2022-11-28T10:25:35+03:00" level=debug msg="Use jq binary for jqFilter"

# To compile with libjq-go add build tag 'use_libjq'
$ go build -tags use_libjq ./cmd/shell-operator
$ LOG_LEVEL=Debug ./shell-operator             
time="2022-11-28T10:23:13+03:00" level=debug msg="Use libjq-go for jqFilter"

# Set JQ_EXEC=yes at runtime to enable executing jq binary (e.g. for debug purposes).
$ JQ_EXEC=yes LOG_LEVEL=Debug ./shell-operator 
time="2022-11-28T10:23:23+03:00" level=debug msg="JQ_EXEC is set, use jq binary for jqFilter"

- use jq binary by default to simplify local setup and testing
- build tag 'use_libjq' should be used to build shell-operator with libjq-go
- add debug message with jqFilter implementation details

Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
@diafour diafour requested a review from yalosev November 28, 2022 07:47
@diafour diafour self-assigned this Nov 28, 2022
@diafour diafour added the publish/image/dev/amd64 Build and push dev image using PR number as docker tag label Nov 28, 2022
@github-actions github-actions bot removed the publish/image/dev/amd64 Build and push dev image using PR number as docker tag label Nov 28, 2022
@yalosev yalosev merged commit cb3195f into main Dec 1, 2022
@yalosev yalosev deleted the feat_build_tag_to_enable_libjq_go branch December 1, 2022 18:18
@diafour diafour added this to the 1.1.0 milestone Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants