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

New software template to add gitlab integration #92

Merged
merged 9 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
backstage.io/kubernetes-id: ${{ values.workflowId }}-ci
janus-idp.io/tekton: ${{ values.workflowId }}
github.com/project-slug: ${{ values.orgName }}/${{ values.repoName }}
gitlab.com/project-slug: ${{ values.orgName }}/${{ values.repoName }}
ElaiShalevRH marked this conversation as resolved.
Show resolved Hide resolved
spec:
type: ${{ values.applicationType }}
system: ${{ values.system }}
Expand Down
33 changes: 33 additions & 0 deletions scaffolder-templates/build/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
stages:
- wait
- update

wait_for_value:
ElaiShalevRH marked this conversation as resolved.
Show resolved Hide resolved
tags:
- shared-podman
ElaiShalevRH marked this conversation as resolved.
Show resolved Hide resolved
stage: wait
image: ubuntu:latest
script: |
sleep 5

update_pipelinerun:
tags:
- shared-podman # Change to whatever tag your Gitlab runner is set to
ElaiShalevRH marked this conversation as resolved.
Show resolved Hide resolved
stage: update
image: ubuntu:latest
script: |
apt-get update && apt-get install -y git
git config --global http.sslVerify "false"
COMMIT_AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
COMMIT_AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
COMMIT_ID=$(git rev-parse --short HEAD)
git config --global user.email "$COMMIT_AUTHOR_EMAIL"
git config --global user.name "$COMMIT_AUTHOR_NAME"
echo "PROJECT_ACCESS_TOKEN is set to: $PROJECT_ACCESS_TOKEN"
git remote set-url origin https://token:$PROJECT_ACCESS_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git
gabriel-farache marked this conversation as resolved.
Show resolved Hide resolved
cd argocd
sed -i "s/git-ssh-credentials/gitlab-ssh-credentials/g" pipelinerun.template
sed "s/__COMMIT_ID__/$COMMIT_ID/g" pipelinerun.template > pipelinerun.yaml
git add pipelinerun.yaml
git commit -m "Updated PipelineRun with commit id $COMMIT_ID"
git push origin HEAD:main -o ci.skip
Loading