Skip to content

Commit

Permalink
ci: modify test workflows namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfouquet committed Oct 5, 2023
1 parent ae08726 commit 8e8d66e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,34 @@ jobs:
./argo-linux-amd64 version
- name: Lint workflows
if: ${{ !(github.ref == 'refs/heads/master') }}
if: github.ref != 'refs/heads/master'
run: |
# Create test namespace
TEST_NAMESPACE=$GITHUB_SHA
kubectl create namespace $TEST_NAMESPACE
# Create copy of Workflows files to change their namespaces
mkdir test
cp workflows/ test/workflows/ -r
# Deploy templates in the test namespace
# Note: the templates have no default namespace so no need to modify them
kubectl apply -f templates/argo-tasks/ --namespace $TEST_NAMESPACE
# Find all workflows that have kind "WorkflowTemplate"
WORKFLOWS=$(grep '^kind: WorkflowTemplate$' -R workflows/ -H | cut -d ':' -f1)
WORKFLOWS=$(grep '^kind: WorkflowTemplate$' -R test/workflows/ -H | cut -d ':' -f1)
# For each workflow attempt to deploy it using kubectl
for wf in $WORKFLOWS; do
# Change namespace in files
sed -i "/^\([[:space:]]*namespace: \).*/s//\1$TEST_NAMESPACE/" $wf
kubectl apply -f $wf --namespace $TEST_NAMESPACE
done
# TODO May need to deploy config files too?
# Finally lint the templates
./argo-linux-amd64 lint templates/ -n $TEST_NAMESPACE
./argo-linux-amd64 lint workflows/ -n $TEST_NAMESPACE
./argo-linux-amd64 lint test/workflows/ -n $TEST_NAMESPACE
# Delete the test namespace
kubectl delete namespaces $TEST_NAMESPACE
Expand Down

0 comments on commit 8e8d66e

Please sign in to comment.