diff --git a/.github/workflows/kind-e2e.yaml b/.github/workflows/kind-e2e.yaml index 91352f3c..c45bae3d 100644 --- a/.github/workflows/kind-e2e.yaml +++ b/.github/workflows/kind-e2e.yaml @@ -2,16 +2,15 @@ name: KinD e2e tests on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] concurrency: group: kind-e2e-tests-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: - e2e: name: e2e tests runs-on: ubuntu-latest @@ -22,84 +21,84 @@ jobs: timeout-minutes: 30 steps: - - name: Set up Go 1.18.x - uses: actions/setup-go@v3 - with: - go-version: 1.18.x - - - name: Setup ko - uses: imjasonh/setup-ko@v0.4 - - - name: Check out code onto GOPATH - uses: actions/checkout@v3 - with: - path: ./src/github.com/${{ github.repository }} - - - name: Setup KinD Cluster with VMware sources. - working-directory: ./src/github.com/${{ github.repository }} - env: - KIND_VERSION: v0.12.0 - run: | - set -x - - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin - - # KinD configuration. - cat > kind.yaml <> $GITHUB_ENV - - - name: Run E2E tests - working-directory: ./src/github.com/${{ github.repository }} - run: | - set -x - - # For logstream to work. - export SYSTEM_NAMESPACE=vmware-sources - # Run the tests tagged as e2e on the KinD cluster. - go test -v -race -timeout=10m -tags=e2e github.com/${{ github.repository }}/test/e2e/... - - - name: Debug - if: ${{ always() }} - run: | - kubectl get pods --all-namespaces - kubectl -n vmware-sources describe pods - kubectl -n vmware-sources get events - - - name: Collect diagnostics - uses: chainguard-dev/actions/kind-diag@main - # Only upload logs on failure. - if: ${{ failure() }} - with: - cluster-resources: nodes - namespace-resources: pods,svc - artifact-name: logs + - name: Set up Go 1.18.x + uses: actions/setup-go@v3 + with: + go-version: 1.18.x + + - name: Setup ko + uses: imjasonh/setup-ko@v0.6 + + - name: Check out code onto GOPATH + uses: actions/checkout@v3 + with: + path: ./src/github.com/${{ github.repository }} + + - name: Setup KinD Cluster with VMware sources. + working-directory: ./src/github.com/${{ github.repository }} + env: + KIND_VERSION: v0.12.0 + run: | + set -x + + curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 + chmod +x ./kind + sudo mv kind /usr/local/bin + + # KinD configuration. + cat > kind.yaml <> $GITHUB_ENV + + - name: Run E2E tests + working-directory: ./src/github.com/${{ github.repository }} + run: | + set -x + + # For logstream to work. + export SYSTEM_NAMESPACE=vmware-sources + # Run the tests tagged as e2e on the KinD cluster. + go test -v -race -timeout=10m -tags=e2e github.com/${{ github.repository }}/test/e2e/... + + - name: Debug + if: ${{ always() }} + run: | + kubectl get pods --all-namespaces + kubectl -n vmware-sources describe pods + kubectl -n vmware-sources get events + + - name: Collect diagnostics + uses: chainguard-dev/actions/kind-diag@main + # Only upload logs on failure. + if: ${{ failure() }} + with: + cluster-resources: nodes + namespace-resources: pods,svc + artifact-name: logs plugins: name: kn plugins @@ -110,42 +109,41 @@ jobs: timeout-minutes: 10 steps: - - name: Set up Go 1.18.x - uses: actions/setup-go@v3 - with: - go-version: 1.18.x - - - name: Setup ko - uses: imjasonh/setup-ko@v0.4 - - - name: Check out code - uses: actions/checkout@v3 - - - name: Setup KinD Cluster - env: - KIND_VERSION: v0.11.1 - run: | - set -x - - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin - - # Create cluster with defaults - kind create cluster - - - name: Deploy vcsim - run: | - ko apply -PRf test/config - kubectl wait --timeout=1m --for=condition=Available deploy/vcsim - kubectl port-forward deploy/vcsim 8989:8989 & - - - name: Build plugins - run: | - go build -o kn-vsphere ./plugins/vsphere/cmd/vsphere - - - name: Test plugin - run: | - ./kn-vsphere auth create --name vsphere-credentials --username user --password pass --verify-url 127.0.0.1:8989 --verify-insecure=true - kubectl get secret vsphere-credentials # assert exists - + - name: Set up Go 1.18.x + uses: actions/setup-go@v3 + with: + go-version: 1.18.x + + - name: Setup ko + uses: imjasonh/setup-ko@v0.6 + + - name: Check out code + uses: actions/checkout@v3 + + - name: Setup KinD Cluster + env: + KIND_VERSION: v0.11.1 + run: | + set -x + + curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 + chmod +x ./kind + sudo mv kind /usr/local/bin + + # Create cluster with defaults + kind create cluster + + - name: Deploy vcsim + run: | + ko apply -PRf test/config + kubectl wait --timeout=1m --for=condition=Available deploy/vcsim + kubectl port-forward deploy/vcsim 8989:8989 & + + - name: Build plugins + run: | + go build -o kn-vsphere ./plugins/vsphere/cmd/vsphere + + - name: Test plugin + run: | + ./kn-vsphere auth create --name vsphere-credentials --username user --password pass --verify-url 127.0.0.1:8989 --verify-insecure=true + kubectl get secret vsphere-credentials # assert exists diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1ecc73bb..be8595ce 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,12 +2,11 @@ on: push: # Sequence of patterns matched against refs/tags tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 name: Create Release jobs: - cli: name: Release the CLI runs-on: ubuntu-latest @@ -16,7 +15,7 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 - + - name: Set up Go uses: actions/setup-go@v3 with: @@ -36,38 +35,38 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.18.x - uses: actions/setup-go@v3 - with: - go-version: 1.18.x + - name: Set up Go 1.18.x + uses: actions/setup-go@v3 + with: + go-version: 1.18.x + + # will install latest ko version and default login/configure + # KO_DOCKER_REPO to ghcr.io + - name: Setup ko for ghcr.io + uses: imjasonh/setup-ko@v0.6 - # will install latest ko version and default login/configure - # KO_DOCKER_REPO to ghcr.io - - name: Setup ko for ghcr.io - uses: imjasonh/setup-ko@v0.4 - - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 1 + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 1 - - name: Get Release URL - id: get_release_url - uses: bruceadams/get-release@v1.2.3 - env: - GITHUB_TOKEN: ${{ github.token }} + - name: Get Release URL + id: get_release_url + uses: bruceadams/get-release@v1.2.3 + env: + GITHUB_TOKEN: ${{ github.token }} - - name: Build and Publish images, Produce release artifact. - run: | - ko resolve --platform=all --tags $(basename "${{ github.ref }}" ) -BRf config/ > release.yaml + - name: Build and Publish images, Produce release artifact. + run: | + ko resolve --platform=all --tags $(basename "${{ github.ref }}" ) -BRf config/ > release.yaml - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.get_release_url.outputs.upload_url }} - asset_path: ./release.yaml - asset_name: release.yaml - asset_content_type: text/plain + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_url.outputs.upload_url }} + asset_path: ./release.yaml + asset_name: release.yaml + asset_content_type: text/plain