diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 388ca005457..ce51b7e8b3f 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -4,6 +4,10 @@ on: - cron: '0 0 * * Sun' workflow_dispatch: +env: + REGISTRY: ghcr.io + IMAGE_NAME: weaveworks/wego-app + name: Nightly jobs: build: @@ -29,8 +33,35 @@ jobs: path: bin retention-days: 1 - test-eks: + build-and-push: needs: [build] + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Unshallow + run: | + git fetch --prune --unshallow + git fetch --tags -f + - name: Log in to the Container registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-build + + + test-eks: + needs: [build-and-push] runs-on: ${{matrix.os}} strategy: matrix: @@ -148,6 +179,7 @@ jobs: run: | export WEGO_BIN_PATH=$(pwd)/bin/gitops-${{matrix.os}}-nightly export CLUSTER_PROVIDER=kubectl + export USE_NIGHTLY_BUILD_TAG=true export DELETE_WEGO_RUNTIME_ON_EACH_TEST=true # cleanup the cluster $WEGO_BIN_PATH flux uninstall --silent @@ -165,7 +197,7 @@ jobs: retention-days: 1 test-gke: - needs: [build] + needs: [build-and-push] runs-on: ${{matrix.os}} strategy: matrix: @@ -282,6 +314,7 @@ jobs: run: | export WEGO_BIN_PATH=$(pwd)/bin/gitops-${{matrix.os}}-nightly export CLUSTER_PROVIDER=kubectl + export USE_NIGHTLY_BUILD_TAG=true export DELETE_WEGO_RUNTIME_ON_EACH_TEST=true # cleanup the cluster $WEGO_BIN_PATH flux uninstall --silent diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d0f642089f8..41a0fb6db87 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -80,7 +80,6 @@ jobs: permissions: contents: read packages: write - steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/pkg/models/manifest.go b/pkg/models/manifest.go index 5a704213f2c..79ca967e200 100644 --- a/pkg/models/manifest.go +++ b/pkg/models/manifest.go @@ -63,6 +63,12 @@ func BootstrapManifests(ctx context.Context, fluxClient flux.Flux, gitProvider g } image, version := WegoImageAndVersion() + + fmt.Println("!!!image") + fmt.Println(image) + fmt.Println("!!!version") + fmt.Println(version) + wegoAppManifests, err := manifests.GenerateWegoAppManifests( manifests.Params{ AppVersion: version, @@ -158,8 +164,16 @@ func BootstrapManifests(ctx context.Context, fluxClient flux.Flux, gitProvider g func WegoImageAndVersion() (string, string) { version := version.Version + + fmt.Println("version") + fmt.Println(version) + if os.Getenv("IS_TEST_ENV") != "" { version = "latest" + fmt.Println(version) + } else if os.Getenv("USE_NIGHTLY_BUILD_TAG") != "" { + version = "nightly-build" + fmt.Println(version) } image := WegoImage @@ -167,6 +181,8 @@ func WegoImageAndVersion() (string, string) { image = localWegoImage } + fmt.Println(version) + return image, version } diff --git a/test/acceptance/test/profiles_test.go b/test/acceptance/test/profiles_test.go index ef13c7756b8..bd8434b1d59 100644 --- a/test/acceptance/test/profiles_test.go +++ b/test/acceptance/test/profiles_test.go @@ -64,7 +64,7 @@ var _ = Describe("Weave GitOps Profiles API", func() { deleteNamespace(namespace) }) - It("gets deployed and is accessible via the service", func() { + FIt("gets deployed and is accessible via the service", func() { By("Installing the Profiles API and setting up the profile helm repository") appRepoRemoteURL = "git@github.com:" + githubOrg + "/" + tip.appRepoName + ".git" installAndVerifyWego(namespace, appRepoRemoteURL) diff --git a/test/acceptance/test/utils.go b/test/acceptance/test/utils.go index bc59654ab85..46b0750c7ec 100644 --- a/test/acceptance/test/utils.go +++ b/test/acceptance/test/utils.go @@ -341,9 +341,19 @@ func getGitRepoVisibility(org string, repo string, providerName gitproviders.Git //Assumes resource will eventually contain a status.Conditions where Type=Ready exists func waitForResourceToBeReady(resourceType string, resourceName string, namespace string, timeout time.Duration) { + var getResourceOutput []byte + EventuallyWithOffset(1, func() error { + kubectlCommand := fmt.Sprintf(`kubectl get pods -n wego-system -o jsonpath="{.items[*].spec.containers[*].image}"`) + var err error + if getResourceOutput, err = exec.Command("sh", "-c", kubectlCommand).CombinedOutput(); err != nil { + return err + } + + fmt.Printf("images: %s\n", string(getResourceOutput)) + log.Infof("Waiting for %s/%s in namespace: %q to be ready : ", resourceType, resourceName, namespace) - kubectlCommand := fmt.Sprintf("kubectl -n %s wait --for=condition=ready %s %s", namespace, resourceType, resourceName) + kubectlCommand = fmt.Sprintf("kubectl -n %s wait --for=condition=ready %s %s", namespace, resourceType, resourceName) if resourceName == "" { kubectlCommand = kubectlCommand + " --all" } @@ -351,7 +361,7 @@ func waitForResourceToBeReady(resourceType string, resourceName string, namespac return err } return nil - }, timeout, "5s").Should(Succeed(), fmt.Sprintf("Failed to find the resource %s of type %s, timeout reached", resourceName, resourceType)) + }, timeout, "5s").Should(Succeed(), fmt.Sprintf("Failed to find the resource %s of type %s, timeout reached. Last seen resources: %s", resourceName, resourceType, string(getResourceOutput))) } func waitForResourceToExist(resourceType string, resourceName string, namespace string, timeout time.Duration) {