Skip to content

Commit

Permalink
Merge 0e0e548 into 20b679b
Browse files Browse the repository at this point in the history
  • Loading branch information
aclevername committed Feb 9, 2022
2 parents 20b679b + 0e0e548 commit 91b1577
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 6 deletions.
37 changes: 35 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
- cron: '0 0 * * Sun'
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: weaveworks/wego-app

name: Nightly
jobs:
build:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -165,7 +197,7 @@ jobs:
retention-days: 1

test-gke:
needs: [build]
needs: [build-and-push]
runs-on: ${{matrix.os}}
strategy:
matrix:
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ jobs:
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down
16 changes: 16 additions & 0 deletions pkg/models/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -158,15 +164,25 @@ 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
if os.Getenv("IS_LOCAL_REGISTRY") != "" {
image = localWegoImage
}

fmt.Println(version)

return image, version
}

Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/test/profiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 12 additions & 2 deletions test/acceptance/test/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,17 +341,27 @@ 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"
}
if _, err := exec.Command("sh", "-c", kubectlCommand).CombinedOutput(); err != nil {
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) {
Expand Down

0 comments on commit 91b1577

Please sign in to comment.