Skip to content

Commit

Permalink
ci: changed order of jobs in e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
omri2001 committed Dec 2, 2024
1 parent a01ee2c commit 13074d2
Showing 1 changed file with 72 additions and 72 deletions.
144 changes: 72 additions & 72 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ permissions:
contents: read

jobs:
github-e2e-env:
name: Github E2E Tests (on development)
gitlab-e2e-env:
name: Gitlab E2E Tests (on development)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand Down Expand Up @@ -57,12 +57,17 @@ jobs:
- name: Kubernetes KinD Cluster
run: |
make init-kind
- name: install nginx
run: |
make init-nginx
- name: install workflows
run: |
make init-argo-workflows
- name: adding license env var
run: |
echo "GITLAB_LICENSE=${{ secrets.GITLAB_LICENSE }}" >> $GITHUB_ENV
- name: install gitlab
run: |
tokens=$(make init-gitlab | tail -n1)
USER_TOKEN=$(echo "$tokens" | grep -oP "(?<=USER_TOKEN )\S+")
echo "GITLAB_TOKEN=$USER_TOKEN" >> $GITHUB_ENV
- name: Build Docker Image
uses: docker/build-push-action@v4
with:
Expand All @@ -79,15 +84,16 @@ jobs:
run: |
helm upgrade --install piper ./helm-chart \
-f ./examples/template.values.dev.yaml \
--set piper.gitProvider.name="github" \
--set piper.gitProvider.token="${{ secrets.GIT_TOKEN }}" \
--set piper.gitProvider.webhook.url="${{ env.NGROK_URL }}/piper/webhook" \
--set piper.gitProvider.name="gitlab" \
--set piper.gitProvider.token="${{ env.GITLAB_TOKEN }}" \
--set piper.gitProvider.url="http://gitlab-webservice-default.gitlab:8080" \
--set piper.gitProvider.webhook.url="http://piper.default/webhook" \
--set piper.gitProvider.webhook.repoList={piper-e2e-test} \
--set piper.gitProvider.organization.name="quickube" \
--set piper.gitProvider.organization.name="pied-pipers" \
--set image.repository=localhost:5001 \
--set piper.argoWorkflows.server.address="${{ env.NGROK_URL }}/argo" \
--set-string env\[0\].name=GIT_WEBHOOK_AUTO_CLEANUP,env\[0\].value="true" && \
sleep 20 && kubectl logs deployment/piper
sleep 20 && kubectl logs deployment/piper
kubectl wait \
--for=condition=ready pod \
--selector=app=piper \
Expand All @@ -99,31 +105,33 @@ jobs:
ref: "main"
- name: inject some changes to piper-e2e-test repo
run: |
mkdir ./gitlab
cd ./gitlab
git clone http://oauth2:${{ env.GITLAB_TOKEN }}@localhost:8080/pied-pipers/piper-e2e-test.git
cp -r ../piper-e2e-test/.workflows ./piper-e2e-test/
cd ./piper-e2e-test
echo "" >> .workflows/triggers.yaml
git config user.name 'e2e-test'
git config user.email 'goshatoo@gmail.com'
git commit -am "trigger e2e test"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GIT_TOKEN }}
path: piper-e2e-test
branch: ${{ github.ref_name }}-test
title: ${{ github.ref_name }}-test
delete-branch: true
git config user.name 'piper-user'
git config user.email 'piper@example.com'
git add -A
git commit -m "add stuff"
git push
git checkout -b ${{ github.ref_name }}-test
rm ./.workflows/triggers.yaml
cat <<EOF > ./.workflows/triggers.yaml
- events:
- merge_request
- merge_request.open
branches: ["*"]
onStart: ["main.yaml"]
onExit: ["exit.yaml"]
templates: ["templates.yaml"]
EOF
git add -A
git commit -m "${{ github.ref_name }}-test"
git push --set-upstream origin ${{ github.ref_name }}-test -o merge_request.create
- name: Wait for workflow creation
run: |
sleep 10
- name: Close Pull Request
uses: peter-evans/close-pull@v3
with:
token: ${{ secrets.GIT_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
repository: "quickube/piper-e2e-test"
comment: Auto-closing pull request
delete-branch: true
- name: Check Result
run: |
kubectl logs deployment/piper
Expand All @@ -138,9 +146,9 @@ jobs:
RESULT=$(kubectl get workflows.argoproj.io -n workflows --selector=branch=$BRANCH_VALID_STRING --no-headers -o custom-columns="Status:status.phase")
MESSAGE=$(kubectl get workflows.argoproj.io -n workflows --selector=branch=$BRANCH_VALID_STRING --no-headers -o custom-columns="Status:status.message")
[ ! "$RESULT" == "Failed" ] && echo "CRD created $MESSAGE" || { echo "Workflow Failed $MESSAGE, existing..."; exit 1; }
gitlab-e2e-env:
name: Gitlab E2E Tests (on development)
needs: github-e2e-env # ngrok tunnel bottleneck
github-e2e-env:
name: Github E2E Tests (on development)
needs: gitlab-e2e-env
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand Down Expand Up @@ -177,17 +185,12 @@ jobs:
- name: Kubernetes KinD Cluster
run: |
make init-kind
- name: install nginx
run: |
make init-nginx
- name: install workflows
run: |
make init-argo-workflows
- name: adding license env var
run: |
echo "GITLAB_LICENSE=${{ secrets.GITLAB_LICENSE }}" >> $GITHUB_ENV
- name: install gitlab
run: |
tokens=$(make init-gitlab | tail -n1)
USER_TOKEN=$(echo "$tokens" | grep -oP "(?<=USER_TOKEN )\S+")
echo "GITLAB_TOKEN=$USER_TOKEN" >> $GITHUB_ENV
- name: Build Docker Image
uses: docker/build-push-action@v4
with:
Expand All @@ -204,16 +207,15 @@ jobs:
run: |
helm upgrade --install piper ./helm-chart \
-f ./examples/template.values.dev.yaml \
--set piper.gitProvider.name="gitlab" \
--set piper.gitProvider.token="${{ env.GITLAB_TOKEN }}" \
--set piper.gitProvider.url="http://gitlab-webservice-default.gitlab:8080" \
--set piper.gitProvider.webhook.url="http://piper.default/webhook" \
--set piper.gitProvider.name="github" \
--set piper.gitProvider.token="${{ secrets.GIT_TOKEN }}" \
--set piper.gitProvider.webhook.url="${{ env.NGROK_URL }}/piper/webhook" \
--set piper.gitProvider.webhook.repoList={piper-e2e-test} \
--set piper.gitProvider.organization.name="pied-pipers" \
--set piper.gitProvider.organization.name="quickube" \
--set image.repository=localhost:5001 \
--set piper.argoWorkflows.server.address="${{ env.NGROK_URL }}/argo" \
--set-string env\[0\].name=GIT_WEBHOOK_AUTO_CLEANUP,env\[0\].value="true" && \
sleep 20 && kubectl logs deployment/piper
sleep 20 && kubectl logs deployment/piper
kubectl wait \
--for=condition=ready pod \
--selector=app=piper \
Expand All @@ -225,33 +227,31 @@ jobs:
ref: "main"
- name: inject some changes to piper-e2e-test repo
run: |
mkdir ./gitlab
cd ./gitlab
git clone http://oauth2:${{ env.GITLAB_TOKEN }}@localhost:8080/pied-pipers/piper-e2e-test.git
cp -r ../piper-e2e-test/.workflows ./piper-e2e-test/
cd ./piper-e2e-test
git config user.name 'piper-user'
git config user.email 'piper@example.com'
git add -A
git commit -m "add stuff"
git push
git checkout -b ${{ github.ref_name }}-test
rm ./.workflows/triggers.yaml
cat <<EOF > ./.workflows/triggers.yaml
- events:
- merge_request
- merge_request.open
branches: ["*"]
onStart: ["main.yaml"]
onExit: ["exit.yaml"]
templates: ["templates.yaml"]
EOF
git add -A
git commit -m "${{ github.ref_name }}-test"
git push --set-upstream origin ${{ github.ref_name }}-test -o merge_request.create
echo "" >> .workflows/triggers.yaml
git config user.name 'e2e-test'
git config user.email 'goshatoo@gmail.com'
git commit -am "trigger e2e test"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GIT_TOKEN }}
path: piper-e2e-test
branch: ${{ github.ref_name }}-test
title: ${{ github.ref_name }}-test
delete-branch: true
- name: Wait for workflow creation
run: |
sleep 10
- name: Close Pull Request
uses: peter-evans/close-pull@v3
with:
token: ${{ secrets.GIT_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
repository: "quickube/piper-e2e-test"
comment: Auto-closing pull request
delete-branch: true
- name: Check Result
run: |
kubectl logs deployment/piper
Expand All @@ -265,4 +265,4 @@ jobs:
## check if status phase not Failed, if yes, show message
RESULT=$(kubectl get workflows.argoproj.io -n workflows --selector=branch=$BRANCH_VALID_STRING --no-headers -o custom-columns="Status:status.phase")
MESSAGE=$(kubectl get workflows.argoproj.io -n workflows --selector=branch=$BRANCH_VALID_STRING --no-headers -o custom-columns="Status:status.message")
[ ! "$RESULT" == "Failed" ] && echo "CRD created $MESSAGE" || { echo "Workflow Failed $MESSAGE, existing..."; exit 1; }
[ ! "$RESULT" == "Failed" ] && echo "CRD created $MESSAGE" || { echo "Workflow Failed $MESSAGE, existing..."; exit 1; }

0 comments on commit 13074d2

Please sign in to comment.