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

feature: kubefile CMD support ENV values with "${...}" and "$..." format #3921

Merged
merged 1 commit into from
Sep 17, 2023

Conversation

LZiHaN
Copy link
Contributor

@LZiHaN LZiHaN commented Sep 13, 2023

🤖 Generated by Copilot at b065a77

Summary

🆕🛠️✅

This pull request adds new syntax options for variable expansion in the expansion package and the getGuestCmd function. It also updates the expand.go file and adds tests to the guest_test.go file to reflect the changes. The new syntaxes allow more flexibility and convenience for users who want to use variables in their cluster commands or mount images.

getGuestCmd tests
new syntax for variables
autumn of expansion

Walkthrough

  • Rename constants and add new ones to support two variable expansion syntaxes: $() and ${} (link)
  • Modify tryReadVariableName to use the renamed constants and handle the new syntaxes (link, link)
  • Add test functions to check getGuestCmd with different variable expressions in pkg/guest/guest_test.go (link)

refer to #3853

@sealos-ci-robot
Copy link
Member

🤖 Generated by lychee action

Summary

Status Count
🔍 Total 932
✅ Successful 392
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 539
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Patch has no changes to coverable lines.

📢 Thoughts on this report? Let us know!.

@willzhang
Copy link
Contributor

i have test it and it's work

# cat Kubefile 
FROM scratch
ENV VERSION=v1.0
CMD ["echo VERSION=${VERSION}"]

The result

root@kube001:~# sealos run registry.cn-shenzhen.aliyuncs.com/cnmirror/test:v1.0
2023-09-15T17:01:19 info start to install app in this cluster
2023-09-15T17:01:19 info Executing SyncStatusAndCheck Pipeline in InstallProcessor
2023-09-15T17:01:19 info Executing ConfirmOverrideApps Pipeline in InstallProcessor
2023-09-15T17:01:19 info are you sure to override these following apps? 
registry.cn-shenzhen.aliyuncs.com/cnmirror/test:v1.0
Yes [y/yes], No [n/no]: y
✔ Yes [y/yes], No [n/no]: y█
2023-09-15T17:01:21 info Executing pipeline MountRootfs in InstallProcessor.
2023-09-15T17:01:21 info Executing pipeline MirrorRegistry in InstallProcessor.
2023-09-15T17:01:21 info Executing UpgradeIfNeed Pipeline in InstallProcessor
VERSION=v1.0
2023-09-15T17:01:21 info succeeded install app in this cluster
2023-09-15T17:01:21 info no nodes that need to be scaled
2023-09-15T17:01:21 info 
      ___           ___           ___           ___       ___           ___
     /\  \         /\  \         /\  \         /\__\     /\  \         /\  \
    /::\  \       /::\  \       /::\  \       /:/  /    /::\  \       /::\  \
   /:/\ \  \     /:/\:\  \     /:/\:\  \     /:/  /    /:/\:\  \     /:/\ \  \
  _\:\~\ \  \   /::\~\:\  \   /::\~\:\  \   /:/  /    /:/  \:\  \   _\:\~\ \  \
 /\ \:\ \ \__\ /:/\:\ \:\__\ /:/\:\ \:\__\ /:/__/    /:/__/ \:\__\ /\ \:\ \ \__\
 \:\ \:\ \/__/ \:\~\:\ \/__/ \/__\:\/:/  / \:\  \    \:\  \ /:/  / \:\ \:\ \/__/
  \:\ \:\__\    \:\ \:\__\        \::/  /   \:\  \    \:\  /:/  /   \:\ \:\__\
   \:\/:/  /     \:\ \/__/        /:/  /     \:\  \    \:\/:/  /     \:\/:/  /
    \::/  /       \:\__\         /:/  /       \:\__\    \::/  /       \::/  /
     \/__/         \/__/         \/__/         \/__/     \/__/         \/__/

                  Website: https://www.sealos.io/
                  Address: github.com/labring/sealos
                  Version: untagged-0ed82702

root@kube001:~# 

@cuisongliu cuisongliu added this to the v4.4 milestone Sep 17, 2023
@cuisongliu cuisongliu merged commit f5c221e into labring:main Sep 17, 2023
2 checks passed
@sealos-ci-robot
Copy link
Member

/cherry-pick release-v4.4

@sealos-ci-robot
Copy link
Member

🤖 says: cherry pick action finished successfully 🎉!
See: https://github.com/labring/sealos/actions/runs/6211427693

cuisongliu pushed a commit that referenced this pull request Sep 17, 2023
Co-authored-by: Zihan Li <eden.zh.li@outlook.com>
@LZiHaN LZiHaN deleted the feat-support-variable-format branch September 18, 2023 15:05
cuisongliu pushed a commit to cuisongliu/sealos that referenced this pull request Sep 29, 2023
…ring#3942)

Co-authored-by: Zihan Li <eden.zh.li@outlook.com>
(cherry picked from commit 4b5f3fe)
cuisongliu added a commit that referenced this pull request Sep 29, 2023
* fix: dnsDomain does not take effect in kubelet (#3834) (#3835)

Signed-off-by: yangxg <yangxggo@163.com>
Co-authored-by: yangxg <yangxggo@163.com>
(cherry picked from commit c60b2fd)

* fix: ignore http server close error (#3854) (#3857)

(cherry picked from commit 2d4d78b)

* fix: skip same path (#3898) (#3899)

Co-authored-by: 榴莲榴莲 <78798447@qq.com>
(cherry picked from commit a256283)

* fix: disable scp checksum by default (#3913) (#3919)

Co-authored-by: fengxsong <fengxsong@outlook.com>
(cherry picked from commit 96cb79d)

* feat: support timeout setting for lvscare http prober (#3901) (#3905)

Co-authored-by: fengxsong <fengxsong@outlook.com>
(cherry picked from commit 6bd5c0a)

* feature: kubefile CMD support ENV variable format (#3921) (#3942)

Co-authored-by: Zihan Li <eden.zh.li@outlook.com>
(cherry picked from commit 4b5f3fe)

* delete cr build for buildah (#3953) (#3954)

Co-authored-by: yy <56745951+lingdie@users.noreply.github.com>
(cherry picked from commit 865803c)

* delete: controller part and useless service. (#3950)

* delete controllers and useless service.

* delete buildah image cr part.

* delete ci.

* roll back

(cherry picked from commit 076c7c7)
Signed-off-by: cuisongliu <cuisongliu@qq.com>

* fix: using extra valid status codes when response status code greater than 400 (#3986) (#3988)

Co-authored-by: fengxsong <fengxsong@outlook.com>
(cherry picked from commit 7be765f)

* feature(main): add lvscare gomod (#3995)

Signed-off-by: cuisongliu <cuisongliu@qq.com>
(cherry picked from commit 050d70b)

* fix(main): sync cert for cert cmd

Signed-off-by: cuisongliu <cuisongliu@qq.com>

#3708 #3887

---------

Co-authored-by: sealos-ci-robot <109538726+sealos-ci-robot@users.noreply.github.com>
Co-authored-by: yy <56745951+lingdie@users.noreply.github.com>
bxy4543 pushed a commit to bxy4543/sealos that referenced this pull request Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants