diff --git a/.github/workflows/golang-ci.yml b/.github/workflows/golang-ci.yml new file mode 100644 index 0000000..5a4d376 --- /dev/null +++ b/.github/workflows/golang-ci.yml @@ -0,0 +1,17 @@ +name: golangci-lint +on: + push: + tags: [v*] + branches: [main] + pull_request: +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.43.0 + args: --timeout 3m0s diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000..a200a91 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,97 @@ +name: Integration + +on: + push: + tags: ["v*"] + branches: [main] + pull_request: + branches: [main] + +jobs: + docker: + runs-on: macos-11 + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - name: Install CLI deps + run: | + brew install kubectl docker coreutils lima + + - name: Build and Install Colima + run: make && sudo make install + + - name: Start Colima + run: colima start --runtime docker + + - name: Delay + run: sleep 5 + + - name: Validate Docker + run: docker ps && docker info + + - name: Build Image + run: docker build integration + + - name: Stop + run: colima stop + + - name: Kubernetes + run: colima start --runtime docker --with-kubernetes + + - name: Delay + run: sleep 5 + + - name: Validate Kubernetes + run: kubectl cluster-info && kubectl version && kubectl get nodes -o wide + + - name: Teardown + run: colima delete -f + + containerd: + runs-on: macos-11 + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - name: Install CLI deps + run: | + brew install kubectl docker coreutils lima + + - name: Build and Install Colima + run: make && sudo make install + + - name: Start Colima + run: colima start --runtime containerd + + - name: Delay + run: sleep 5 + + - name: Validate Containerd + run: colima nerdctl ps && colima nerdctl info + + - name: Build Image + run: colima nerdctl -- build integration + + - name: Stop + run: colima stop + + - name: Kubernetes + run: colima start --runtime containerd --with-kubernetes + + - name: Delay + run: sleep 5 + + - name: Validate Kubernetes + run: kubectl cluster-info && kubectl version && kubectl get nodes -o wide + + - name: Teardown + run: colima delete -f diff --git a/README.md b/README.md index 223da66..c956c60 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Colima [![Go](https://github.com/abiosoft/colima/actions/workflows/go.yml/badge.svg)](https://github.com/abiosoft/colima/actions/workflows/go.yml) +[![Integration](https://github.com/abiosoft/colima/actions/workflows/integration.yml/badge.svg)](https://github.com/abiosoft/colima/actions/workflows/integration.yml) Container runtimes on macOS (and Linux) with minimal setup. diff --git a/app/app.go b/app/app.go index aa9eec8..2f2d263 100644 --- a/app/app.go +++ b/app/app.go @@ -4,7 +4,6 @@ import ( "fmt" "strconv" - "github.com/abiosoft/colima/cli" "github.com/abiosoft/colima/config" "github.com/abiosoft/colima/environment" "github.com/abiosoft/colima/environment/container/kubernetes" @@ -134,11 +133,6 @@ func (c colimaApp) Stop() error { } func (c colimaApp) Delete() error { - y := cli.Prompt("are you sure you want to delete " + config.Profile().DisplayName + " and all settings") - if !y { - return nil - } - log.Println("deleting", config.Profile().DisplayName) // the order for teardown is: diff --git a/cmd/delete.go b/cmd/delete.go index f3c12e2..5ef0078 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -1,10 +1,16 @@ package cmd import ( + "github.com/abiosoft/colima/cli" "github.com/abiosoft/colima/cmd/root" + "github.com/abiosoft/colima/config" "github.com/spf13/cobra" ) +var deleteCmdArgs struct { + force bool +} + // deleteCmd represents the delete command var deleteCmd = &cobra.Command{ Use: "delete", @@ -16,10 +22,19 @@ initial startup of Colima. If you simply want to reset the Kubernetes cluster, run 'colima kubernetes reset'.`, RunE: func(cmd *cobra.Command, args []string) error { + if !deleteCmdArgs.force { + y := cli.Prompt("are you sure you want to delete " + config.Profile().DisplayName + " and all settings") + if !y { + return nil + } + } + return newApp().Delete() }, } func init() { root.Cmd().AddCommand(deleteCmd) + + deleteCmd.Flags().BoolVarP(&deleteCmdArgs.force, "force", "f", false, "do not prompt for yes/no") } diff --git a/integration/Dockerfile b/integration/Dockerfile new file mode 100644 index 0000000..f667a56 --- /dev/null +++ b/integration/Dockerfile @@ -0,0 +1,5 @@ +# sample dockerfile to test image building +# without pulling from docker hub +FROM scratch + +COPY . /files \ No newline at end of file