Skip to content

Commit 4e00c56

Browse files
authored
Merge branch 'master' into volume
2 parents 6ea64ab + ed58fbc commit 4e00c56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+818
-482
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ contact_links:
44
url: https://github.com/lima-vm/lima/discussions
55
about: We use GitHub Discussions for questions, GitHub issues for tracking bug reports and feature requests
66
- name: Chat with Lima users and developers
7-
url: https://slack.rancher.io/
8-
about: Rancher Users slack has `#lima` channel, colocated with `#rancher-desktop` channel (Lima is not a Rancher project)
7+
url: https://slack.cncf.io/
8+
about: CNCF slack has `#lima` channel

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Run golangci-lint
2323
uses: golangci/golangci-lint-action@v3
2424
with:
25-
version: v1.48.0
25+
version: v1.49.0
2626
args: --verbose
2727
- name: Run yamllint
2828
run: yamllint .
@@ -39,7 +39,7 @@ jobs:
3939
- name: Check hyperlinks
4040
uses: docker://dkhamsing/awesome_bot:latest
4141
with:
42-
args: /github/workspace/README.md --allow-dupe --allow-redirect --request-delay 1 --white-list https://img.shields.io,http://127.0.0.1:8080,https://github.com/lima-vm/lima/releases/download
42+
args: /github/workspace/README.md --allow-dupe --allow-redirect --request-delay 1 --white-list https://img.shields.io,http://127.0.0.1:8080,https://github.com/lima-vm/lima/releases/download,https://xbarapp.com
4343
- name: Unit tests
4444
run: go test -v ./...
4545
- name: Make

.golangci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ run:
2222
linters:
2323
disable-all: true
2424
enable:
25-
- deadcode
2625
- depguard
2726
- gofmt
2827
- goimports
@@ -31,9 +30,7 @@ linters:
3130
- misspell
3231
- nakedret
3332
# - prealloc
34-
- structcheck
3533
- typecheck
36-
- varcheck
3734
# - asciicheck
3835
# - bodyclose
3936
# - dogsled
@@ -76,9 +73,10 @@ linters:
7673
# - stylecheck
7774
# - testpackage
7875
# - tparallel
76+
- revive
7977
# - unconvert
8078
# - unparam
81-
# - unused
79+
- unused
8280
# - whitespace
8381
# - wrapcheck
8482
# - wsl

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ binaries: clean \
3131
_output/bin/lima$(bat) \
3232
_output/bin/limactl$(exe) \
3333
_output/bin/nerdctl.lima \
34+
_output/bin/apptainer.lima \
3435
_output/bin/docker.lima \
3536
_output/bin/podman.lima \
3637
_output/share/lima/lima-guestagent.Linux-x86_64 \
@@ -62,6 +63,10 @@ _output/bin/nerdctl.lima:
6263
mkdir -p _output/bin
6364
cp -a ./cmd/nerdctl.lima $@
6465

66+
_output/bin/apptainer.lima: ./cmd/apptainer.lima
67+
@mkdir -p _output/bin
68+
cp -a $^ $@
69+
6570
_output/bin/docker.lima: ./cmd/docker.lima
6671
@mkdir -p _output/bin
6772
cp -a $^ $@
@@ -102,6 +107,7 @@ install: uninstall
102107
# Use tar rather than cp, for better symlink handling
103108
( cd _output && tar c * | tar Cxv "$(DEST)" )
104109
if [ "$(shell uname -s )" != "Linux" -a ! -e "$(DEST)/bin/nerdctl" ]; then ln -sf nerdctl.lima "$(DEST)/bin/nerdctl"; fi
110+
if [ "$(shell uname -s )" != "Linux" -a ! -e "$(DEST)/bin/apptainer" ]; then ln -sf apptainer.lima "$(DEST)/bin/apptainer"; fi
105111

106112
.PHONY: uninstall
107113
uninstall:
@@ -111,10 +117,12 @@ uninstall:
111117
"$(DEST)/bin/lima$(bat)" \
112118
"$(DEST)/bin/limactl$(exe)" \
113119
"$(DEST)/bin/nerdctl.lima" \
120+
"$(DEST)/bin/apptainer.lima" \
114121
"$(DEST)/bin/docker.lima" \
115122
"$(DEST)/bin/podman.lima" \
116123
"$(DEST)/share/lima" "$(DEST)/share/doc/lima"
117124
if [ "$$(readlink "$(DEST)/bin/nerdctl")" = "nerdctl.lima" ]; then rm "$(DEST)/bin/nerdctl"; fi
125+
if [ "$$(readlink "$(DEST)/bin/apptainer")" = "apptainer.lima" ]; then rm "$(DEST)/bin/apptainer"; fi
118126

119127
.PHONY: lint
120128
lint:

README.ja.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
This is an *informal* translation of [`README.md` (revision 0aebc304, 2022-Apr-25)](https://github.com/lima-vm/lima/blob/0aebc304f8cdc65375f8bfca7414ced6397a4fcc/README.md) in Japanese.
1+
This is an *informal* translation of [`README.md` (revision 725d7dca, 2022-Oct-8)](https://github.com/lima-vm/lima/blob/725d7dcac3e641905a444777bce8a65190db1692/README.md) in Japanese.
22
This translation might be out of sync with the English version.
33
Please refer to the [English `README.md`](README.md) for the latest information.
44

5-
[`README.md` (リビジョン 0aebc304, 2022年4月25日)](https://github.com/lima-vm/lima/blob/0aebc304f8cdc65375f8bfca7414ced6397a4fcc/README.md)*非正式* な日本語訳です。
5+
[`README.md` (リビジョン 725d7dca, 2022年10月8日)](https://github.com/lima-vm/lima/blob/725d7dcac3e641905a444777bce8a65190db1692/README.md)*非正式* な日本語訳です。
66
英語版からの翻訳が遅れていることがあります。
77
最新の情報については[英語版 `README.md`](README.md)をご覧ください。
88

@@ -41,6 +41,8 @@ LimaはmacOSホストで使用されることを想定していますが、Linux
4141

4242
このプロジェクトは[Limaドライバプロジェクト (ARM Mali GPUのためのドライバ)](https://gitlab.freedesktop.org/lima)とは無関係です。
4343

44+
Limaに関する講演のスライド及びビデオへのリンクが[talks](docs/talks.md)のページにあります。
45+
4446
## 動機
4547

4648
Limaの目的は、Macユーザに[nerdctl (contaiNERDctl)](https://github.com/containerd/nerdctl)を含め[containerd](https://containerd.io)を広めることです。が、Limaではコンテナでないアプリケーションも使用できます。
@@ -59,9 +61,12 @@ GUI:
5961

6062
### コミュニケーション方法
6163
- [GitHub Discussions](https://github.com/lima-vm/lima/discussions)
62-
- Rancher Users Slackで`#rancher-desktop`チャンネルと同居している`#lima`チャンネル( LimaはRancherのプロジェクトではありません )
63-
- 新規アカウント: https://slack.rancher.io/
64-
- ログイン: https://rancher-users.slack.com/
64+
- CNCF Slackの`#lima`チャンネル
65+
- 新規アカウント: https://slack.cncf.io/
66+
- ログイン: https://cloud-native.slack.com/
67+
68+
### 行動規範
69+
Limaは[CNCF行動規範](https://github.com/cncf/foundation/blob/master/code-of-conduct.md)に従います。
6570

6671
##
6772

@@ -337,7 +342,7 @@ AlmaLinux, Alpine, Arch Linux, Debian, Fedora, openSUSE, Oracle Linux, Rocky が
337342
コンテナランタイムの例:
338343
- [`./examples/docker.yaml`](./examples/docker.yaml): Docker
339344
- [`./examples/podman.yaml`](./examples/podman.yaml): Podman
340-
- [`./examples/singularity.yaml`](./examples/singularity.yaml): Singularity
345+
- [`./examples/apptainer.yaml`](./examples/apptainer.yaml): Apptainer
341346

342347
コンテナイメージビルダの例:
343348
- [`./examples/buildkit.yaml`](./examples/buildkit.yaml): BuildKit
@@ -438,7 +443,8 @@ M1のmacOSでは、最近のLinuxゲストを実行するには[Homebrew版のQE
438443

439444
デフォルトのIP 192.168.5.15 はホストや他のゲストからアクセスできません。
440445

441-
ホストや他の仮想マシンからアクセス可能な別のIPアドレスを追加するためには、[`vde_vmnet`](https://github.com/lima-vm/vde_vmnet)を有効にしてください。
446+
ホストや他の仮想マシンからアクセス可能な別のIPアドレスを追加するためには、[`socket_vmnet`](https://github.com/lima-vm/socket_vmnet) (Lima v0.12以降)
447+
または [`vde_vmnet`](https://github.com/lima-vm/vde_vmnet) (廃止予定) を有効にしてください。
442448

443449
[`./docs/network.md`](./docs/network.md)を参照してください。
444450

@@ -487,3 +493,11 @@ LIMA_HOME="$HOME/.local/share/rancher-desktop/lima" "$(ls -d /tmp/.mount_ranche*
487493
- `/var/log/cloud-init-output.log` (ゲスト内)
488494
- `/var/log/cloud-init.log` (ゲスト内)
489495
- YAML内にタブとスペースを混在させていないことを確認してください。
496+
497+
- - -
498+
499+
**私たちは [Cloud Native Computing Foundation](https://cncf.io/) sandbox project です。**
500+
501+
<img src="https://www.cncf.io/wp-content/uploads/2022/07/cncf-color-bg.svg" width=300 />
502+
503+
The Linux Foundation® (TLF) has registered trademarks and uses trademarks. For a list of TLF trademarks, see [Trademark Usage](https://www.linuxfoundation.org/trademark-usage/).

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ GUI:
5353

5454
### Communication channels
5555
- [GitHub Discussions](https://github.com/lima-vm/lima/discussions)
56-
- `#lima` channel, colocated with `#rancher-desktop` channel in Rancher Users Slack (Lima is not a Rancher project)
57-
- New account: https://slack.rancher.io/
58-
- Login: https://rancher-users.slack.com/
56+
- `#lima` channel in the CNCF Slack
57+
- New account: https://slack.cncf.io/
58+
- Login: https://cloud-native.slack.com/
5959

6060
### Code of Conduct
6161
Lima follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
@@ -342,7 +342,7 @@ Yes, any container engine should work with Lima.
342342
Container runtime examples:
343343
- [`./examples/docker.yaml`](./examples/docker.yaml): Docker
344344
- [`./examples/podman.yaml`](./examples/podman.yaml): Podman
345-
- [`./examples/singularity.yaml`](./examples/singularity.yaml): Singularity
345+
- [`./examples/apptainer.yaml`](./examples/apptainer.yaml): Apptainer
346346

347347
Container image builder examples:
348348
- [`./examples/buildkit.yaml`](./examples/buildkit.yaml): BuildKit

cmd/apptainer.lima

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
set -eu
3+
: "${LIMA_INSTANCE:=apptainer}"
4+
5+
if [ "$(limactl ls -q "$LIMA_INSTANCE" 2>/dev/null)" != "$LIMA_INSTANCE" ]; then
6+
echo "instance \"$LIMA_INSTANCE\" does not exist, run \`limactl start --name=$LIMA_INSTANCE template://apptainer\` to create a new instance" >&2
7+
exit 1
8+
fi
9+
export LIMA_INSTANCE
10+
exec lima APPTAINER_HOME="$HOME" apptainer "$@"

cmd/lima-guestagent/install_systemd_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"path/filepath"
99
"strings"
1010

11-
"github.com/lima-vm/lima/pkg/templateutil"
11+
"github.com/lima-vm/lima/pkg/textutil"
1212
"github.com/sirupsen/logrus"
1313
"github.com/spf13/cobra"
1414
)
@@ -68,5 +68,5 @@ func generateSystemdUnit() ([]byte, error) {
6868
m := map[string]string{
6969
"Binary": selfExeAbs,
7070
}
71-
return templateutil.Execute(systemdUnitTemplate, m)
71+
return textutil.ExecuteTemplate(systemdUnitTemplate, m)
7272
}

cmd/limactl/edit.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"path/filepath"
99

1010
"github.com/AlecAivazis/survey/v2"
11+
"github.com/lima-vm/lima/pkg/editutil"
1112
"github.com/lima-vm/lima/pkg/limayaml"
1213
networks "github.com/lima-vm/lima/pkg/networks/reconcile"
1314
"github.com/lima-vm/lima/pkg/start"
@@ -55,8 +56,8 @@ func editAction(cmd *cobra.Command, args []string) error {
5556
hdr := fmt.Sprintf("# Please edit the following configuration for Lima instance %q\n", instName)
5657
hdr += "# and an empty file will abort the edit.\n"
5758
hdr += "\n"
58-
hdr += generateEditorWarningHeader()
59-
yBytes, err := openEditor(instName, yContent, hdr)
59+
hdr += editutil.GenerateEditorWarningHeader()
60+
yBytes, err := editutil.OpenEditor(instName, yContent, hdr)
6061
if err != nil {
6162
return err
6263
}

cmd/limactl/guessarg/guessarg.go

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package guessarg
2+
3+
import (
4+
"fmt"
5+
"net/url"
6+
"path"
7+
"path/filepath"
8+
"strings"
9+
10+
"github.com/containerd/containerd/identifiers"
11+
)
12+
13+
func SeemsTemplateURL(arg string) (bool, *url.URL) {
14+
u, err := url.Parse(arg)
15+
if err != nil {
16+
return false, u
17+
}
18+
return u.Scheme == "template", u
19+
}
20+
21+
func SeemsHTTPURL(arg string) bool {
22+
u, err := url.Parse(arg)
23+
if err != nil {
24+
return false
25+
}
26+
if u.Scheme != "http" && u.Scheme != "https" {
27+
return false
28+
}
29+
return true
30+
}
31+
32+
func SeemsFileURL(arg string) bool {
33+
u, err := url.Parse(arg)
34+
if err != nil {
35+
return false
36+
}
37+
return u.Scheme == "file"
38+
}
39+
40+
func SeemsYAMLPath(arg string) bool {
41+
if strings.Contains(arg, "/") {
42+
return true
43+
}
44+
lower := strings.ToLower(arg)
45+
return strings.HasSuffix(lower, ".yml") || strings.HasSuffix(lower, ".yaml")
46+
}
47+
48+
func InstNameFromURL(urlStr string) (string, error) {
49+
u, err := url.Parse(urlStr)
50+
if err != nil {
51+
return "", err
52+
}
53+
return InstNameFromYAMLPath(path.Base(u.Path))
54+
}
55+
56+
func InstNameFromYAMLPath(yamlPath string) (string, error) {
57+
s := strings.ToLower(filepath.Base(yamlPath))
58+
s = strings.TrimSuffix(strings.TrimSuffix(s, ".yml"), ".yaml")
59+
s = strings.ReplaceAll(s, ".", "-")
60+
if err := identifiers.Validate(s); err != nil {
61+
return "", fmt.Errorf("filename %q is invalid: %w", yamlPath, err)
62+
}
63+
return s, nil
64+
}

cmd/limactl/info.go

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import (
44
"encoding/json"
55
"fmt"
66

7-
"github.com/lima-vm/lima/pkg/limayaml"
8-
"github.com/lima-vm/lima/pkg/store/dirnames"
9-
"github.com/lima-vm/lima/pkg/version"
7+
"github.com/lima-vm/lima/pkg/infoutil"
108
"github.com/spf13/cobra"
119
)
1210

@@ -20,37 +18,8 @@ func newInfoCommand() *cobra.Command {
2018
return infoCommand
2119
}
2220

23-
type TemplateYAML struct {
24-
Name string `json:"name"`
25-
Location string `json:"location"`
26-
}
27-
28-
type Info struct {
29-
Version string `json:"version"`
30-
Templates []TemplateYAML `json:"templates"`
31-
DefaultTemplate *limayaml.LimaYAML `json:"defaultTemplate"`
32-
LimaHome string `json:"limaHome"`
33-
// TODO: add diagnostic info of QEMU
34-
}
35-
3621
func infoAction(cmd *cobra.Command, args []string) error {
37-
b, err := readDefaultTemplate()
38-
if err != nil {
39-
return err
40-
}
41-
y, err := limayaml.Load(b, "")
42-
if err != nil {
43-
return err
44-
}
45-
info := &Info{
46-
Version: version.Version,
47-
DefaultTemplate: y,
48-
}
49-
info.Templates, err = listTemplateYAMLs()
50-
if err != nil {
51-
return err
52-
}
53-
info.LimaHome, err = dirnames.LimaDir()
22+
info, err := infoutil.GetInfo()
5423
if err != nil {
5524
return err
5625
}

0 commit comments

Comments
 (0)