diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml new file mode 100644 index 000000000..bdbe01df2 --- /dev/null +++ b/.github/workflows/e2e.yaml @@ -0,0 +1,66 @@ +# Copyright 2024 Flant JSC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: e2e + +env: + CI_COMMIT_REF_NAME: ${{ github.ref_name }} + +on: + workflow_dispatch: + pull_request: + branches: + - ci/tests/e2e-workflow + push: + branches: + - ci/tests/e2e-workflow + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +jobs: + show_dev_manifest: + runs-on: ubuntu-latest + name: Run e2e + steps: + - name: Set up Go 1.21 + uses: actions/setup-go@v5 + with: + go-version: "1.21" + + - name: Install Task + uses: arduino/setup-task@v2 + + - uses: + azure/setup-kubectl@v3 + # default is latest stable + id: install + + - uses: actions/checkout@v4 + + - uses: azure/k8s-set-context@v4 + with: + method: service-account + k8s-url: https://api.e2e.virtlab.flant.com + k8s-secret: ${{ secrets.E2E_VIRTUALIZATION_SA_SECRET }} + + - name: e2e + run: | + export E2E_CLUSTERTRANSPORT_KUBECONFIG=$KUBECONFIG + task run_local diff --git a/tests/e2e/Taskfile.yaml b/tests/e2e/Taskfile.yaml index 87057e16b..625d4088c 100644 --- a/tests/e2e/Taskfile.yaml +++ b/tests/e2e/Taskfile.yaml @@ -3,7 +3,7 @@ version: "3" silent: true vars: - E2E_CLUSTERTRANSPORT_KUBECONFIG: '{{default "$HOME/.kube/config" .E2E_CLUSTERTRANSPORT_KUBECONFIG}}' + E2E_CLUSTERTRANSPORT_KUBECONFIG: '{{ .E2E_CLUSTERTRANSPORT_KUBECONFIG | default "$HOME/.kube/config"}}' GINKGO_VERSION: "2.13.2" VERSION: "v1.0.0" @@ -22,9 +22,9 @@ tasks: ginkgo: cmds: - | - v=($(ginkgo version 2>/dev/null)) - if [ "${v[2]}" != "{{ .GINKGO_VERSION }}" ]; then - go install github.com/onsi/ginkgo/v2/ginkgo@v"{{ .GINKGO_VERSION }}" ; + v=($(ginkgo version 2>/dev/null || true)) + if [ "${v[2]}" != "{{ .GINKGO_VERSION }}" ]; then + go install github.com/onsi/ginkgo/v2/ginkgo@v"{{ .GINKGO_VERSION }}" ; fi run: desc: "Run e2e tests" @@ -47,7 +47,6 @@ tasks: run_one: desc: "Run one test or group" deps: - - virtctl - ginkgo cmds: - | diff --git a/tests/e2e/tests_suite_test.go b/tests/e2e/tests_suite_test.go index 57e62abc5..8f50fe5d6 100644 --- a/tests/e2e/tests_suite_test.go +++ b/tests/e2e/tests_suite_test.go @@ -23,6 +23,7 @@ import ( virt "github.com/deckhouse/virtualization/tests/e2e/virtctl" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "sigs.k8s.io/yaml" "testing" "time" ) @@ -48,6 +49,8 @@ func init() { if conf, err = config.GetConfig(); err != nil { panic(err) } + b, _ := yaml.Marshal(conf) + fmt.Println(string(b)) if kubectl, err = kc.NewKubectl(kc.KubectlConf(conf.ClusterTransport)); err != nil { panic(err) }