Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gitjob end-to-end tests with SSH key #2109

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/scripts/deploy-fleet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ function eventually {
}

# usage: ./deploy-fleet.sh ghcr.io/rancher/fleet:sha-49f6f81 ghcr.io/rancher/fleet-agent:1h
if [ $# -ge 2 ] && [ -n "$1" ] && [ -n "$2" ]; then
if [ $# -ge 3 ] && [ -n "$1" ] && [ -n "$2" ] && [ -n "$3" ]; then
fleetRepo="${1%:*}"
fleetTag="${1#*:}"
agentRepo="${2%:*}"
agentTag="${2#*:}"
gitjobRepo="${3%:*}"
gitjobTag="${3#*:}"
else
fleetRepo="rancher/fleet"
fleetTag="dev"
agentRepo="rancher/fleet-agent"
agentTag="dev"
gitjobRepo="rancher/fleet-gitjob"
gitjobTag="dev"
fi

eventually helm upgrade --install fleet-crd charts/fleet-crd \
Expand All @@ -34,7 +38,9 @@ eventually helm upgrade --install fleet charts/fleet \
--set image.tag="$fleetTag" \
--set agentImage.repository="$agentRepo" \
--set agentImage.tag="$agentTag" \
--set agentImage.imagePullPolicy=IfNotPresent
--set agentImage.imagePullPolicy=IfNotPresent \
--set gitjob.repository="$gitjobRepo" \
--set gitjob.tag="$gitjobTag"

# wait for controller and agent rollout
kubectl -n cattle-fleet-system rollout status deploy/fleet-controller
Expand Down
26 changes: 25 additions & 1 deletion .github/workflows/aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,29 @@ jobs:
push: true
tags: ${{ steps.meta-fleet-agent.outputs.tags }}
labels: ${{ steps.meta-fleet-agent.outputs.labels }}
-
id: meta-fleet-gitjob
uses: docker/metadata-action@v5
with:
images: |
ttl.sh/rancher/fleet-gitjob-${{ steps.uuid.outputs.uuid }}
tags: type=raw,value=1h
-
uses: docker/build-push-action@v5
with:
context: .
file: package/Dockerfile.gitjob
build-args: |
ARCH=${{ env.GOARCH }}
push: true
tags: ${{ steps.meta-fleet-gitjob.outputs.tags }}
labels: ${{ steps.meta-fleet-gitjob.outputs.labels }}
-
name: Deploy Fleet
run: |
export KUBECONFIG="$GITHUB_WORKSPACE/kubeconfig-fleet-ci"
echo "${{ steps.meta-fleet.outputs.tags }} ${{ steps.meta-fleet-agent.outputs.tags }}"
./.github/scripts/deploy-fleet.sh ${{ steps.meta-fleet.outputs.tags }} ${{ steps.meta-fleet-agent.outputs.tags }}
./.github/scripts/deploy-fleet.sh ${{ steps.meta-fleet.outputs.tags }} ${{ steps.meta-fleet-agent.outputs.tags }} ${{ steps.meta-fleet-gitjob.outputs.tags }}
-
name: Fleet E2E Tests
env:
Expand Down Expand Up @@ -159,6 +176,13 @@ jobs:
echo "${{ secrets.CI_AKS_SSH_PUBKEY }}" > "$GIT_SSH_PUBKEY"

ginkgo e2e/require-secrets

export GIT_GITJOB_SSH_KEY="$GITHUB_WORKSPACE/id_ed25519"
export GIT_GITJOB_SSH_PUBKEY="$GITHUB_WORKSPACE/id_ed25519.pub"
echo "${{ secrets.CI_GITJOB_SSH_KEY }}" > "$GIT_GITJOB_SSH_KEY"
echo "${{ secrets.CI_GITJOB_SSH_PUBKEY }}" > "$GIT_GITJOB_SSH_PUBKEY"

ginkgo e2e/gitjob
-
name: Delete AKS cluster
# We always tear down the cluster, to avoid costs. Except when running
Expand Down
26 changes: 25 additions & 1 deletion .github/workflows/gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,28 @@ jobs:
push: true
tags: ${{ steps.meta-fleet-agent.outputs.tags }}
labels: ${{ steps.meta-fleet-agent.outputs.labels }}
-
id: meta-fleet-gitjob
uses: docker/metadata-action@v5
with:
images: |
ttl.sh/rancher/fleet-gitjob-${{ steps.uuid.outputs.uuid }}
tags: type=raw,value=1h
-
uses: docker/build-push-action@v5
with:
context: .
file: package/Dockerfile.gitjob
build-args: |
ARCH=${{ env.GOARCH }}
push: true
tags: ${{ steps.meta-fleet-gitjob.outputs.tags }}
labels: ${{ steps.meta-fleet-gitjob.outputs.labels }}
-
name: Deploy Fleet
run: |
echo "${{ steps.meta-fleet.outputs.tags }} ${{ steps.meta-fleet-agent.outputs.tags }}"
./.github/scripts/deploy-fleet.sh ${{ steps.meta-fleet.outputs.tags }} ${{ steps.meta-fleet-agent.outputs.tags }}
./.github/scripts/deploy-fleet.sh ${{ steps.meta-fleet.outputs.tags }} ${{ steps.meta-fleet-agent.outputs.tags }} ${{ steps.meta-fleet-gitjob.outputs.tags }}
-
name: Fleet E2E Tests
env:
Expand Down Expand Up @@ -160,6 +177,13 @@ jobs:
echo "${{ secrets.CI_GKE_SSH_PUBKEY }}" > "$GIT_SSH_PUBKEY"

ginkgo e2e/require-secrets

export GIT_GITJOB_SSH_KEY="$GITHUB_WORKSPACE/id_ed25519"
export GIT_GITJOB_SSH_PUBKEY="$GITHUB_WORKSPACE/id_ed25519.pub"
echo "${{ secrets.CI_GITJOB_SSH_KEY }}" > "$GIT_GITJOB_SSH_KEY"
echo "${{ secrets.CI_GITJOB_SSH_PUBKEY }}" > "$GIT_GITJOB_SSH_PUBKEY"

ginkgo e2e/gitjob
-
name: Delete GKE cluster
if: ${{ always() && github.event.inputs.keep_cluster != 'yes' }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ jobs:
echo "${{ secrets.CI_SSH_PUBKEY }}" > "$GIT_SSH_PUBKEY"

ginkgo e2e/require-secrets

export GIT_GITJOB_SSH_KEY="$GITHUB_WORKSPACE/id_ed25519"
export GIT_GITJOB_SSH_PUBKEY="$GITHUB_WORKSPACE/id_ed25519.pub"
echo "${{ secrets.CI_GITJOB_SSH_KEY }}" > "$GIT_GITJOB_SSH_KEY"
echo "${{ secrets.CI_GITJOB_SSH_PUBKEY }}" > "$GIT_GITJOB_SSH_PUBKEY"

ginkgo e2e/gitjob
-
name: Dump Failed Environment
Expand Down
Loading