-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
125 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
exec echo "$GITLAB_PASSWORD" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
#set -u | ||
|
||
DEFAULT_POLL_TIMEOUT=10 | ||
POLL_TIMEOUT=${POLL_TIMEOUT:-$DEFAULT_POLL_TIMEOUT} | ||
|
||
echo ${GITHUB_REF} | ||
# leave ancient history undisturbed | ||
git fetch --shallow-since=01/01/2020 | ||
|
||
#github_ref | ||
#git checkout "${GITHUB_REF}" | ||
|
||
#branch=${GITHUB_REPOSITORY}/$(git symbolic-ref --short HEAD) | ||
shortbranch=$(git symbolic-ref --short HEAD) | ||
|
||
#git config --global credential.username $GITLAB_USERNAME | ||
#git config --global core.askPass .github/scripts/cred-helper.sh | ||
#git config --global credential.helper cache | ||
#git remote add mirror $GITLAB_URL | ||
#echo pushing to $shortbranch branch at $(git remote get-url --push mirror) | ||
#git push mirror $shortbranch | ||
|
||
|
||
# need a token with api acces | ||
curl --silent --header "PRIVATE-TOKEN: ${GITLAB_PASSWORD2}" -X https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/mirror/pull | ||
|
||
sleep $POLL_TIMEOUT | ||
|
||
|
||
pipeline_id=$(curl --silent "https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/repository/commits/${shortbranch}" | jq '.last_pipeline.id') | ||
|
||
echo "Triggered CI for branch ${shortbranch}" | ||
echo "Working with pipeline id #${pipeline_id}" | ||
echo "Poll timeout set to ${POLL_TIMEOUT}" | ||
|
||
ci_status="pending" | ||
|
||
until [[ "$ci_status" != "pending" && "$ci_status" != "running" ]] | ||
do | ||
sleep $POLL_TIMEOUT | ||
ci_output=$(curl --silent "https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines/${pipeline_id}") | ||
ci_status=$(jq -n "$ci_output" | jq -r .status) | ||
ci_web_url=$(jq -n "$ci_output" | jq -r .web_url) | ||
|
||
echo "Current pipeline status: ${ci_status}" | ||
if [ "$ci_status" = "running" ] | ||
then | ||
echo "Checking pipeline status..." | ||
curl -d '{"state":"pending", "target_url": "'${ci_web_url}'", "context": "gitlab-ci"}' -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.antiope-preview+json" -X POST --silent "https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" > /dev/null | ||
fi | ||
done | ||
|
||
echo "Pipeline finished with status ${ci_status}" | ||
|
||
if [ "$ci_status" = "success" ] | ||
then | ||
curl -d '{"state":"success", "target_url": "'${ci_web_url}'", "context": "gitlab-ci"}' -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.antiope-preview+json" -X POST --silent "https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" | ||
exit 0 | ||
elif [ "$ci_status" = "failed" ] | ||
then | ||
curl -d '{"state":"failure", "target_url": "'${ci_web_url}'", "context": "gitlab-ci"}' -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.antiope-preview+json" -X POST --silent "https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Mirror and run GitLab CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Mirror + trigger CI | ||
env: | ||
GITLAB_URL: "https://gitlab.cern.ch/vavolkl/FCCSW" | ||
GITLAB_HOSTNAME: "gitlab.cern.ch" | ||
GITLAB_USERNAME: "vavolkl" | ||
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} | ||
GITLAB_PASSWORD2: ${{ secrets.GITLAB_PASSWORD2 }} | ||
GITLAB_PROJECT_ID: 93907 | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
POLL_TIMEOUT: 25 | ||
run: | | ||
ls -alh | ||
git status | ||
./.github/scripts/gitlabmirror.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# the git version on centos7 is too old for fetch | ||
variables: | ||
GIT_STRATEGY: clone | ||
|
||
build-all: | ||
script: | ||
- source init.sh | ||
- mkdir build; cd build; cmake ..; make -j `getconf _NPROCESSORS_ONLN` | ||
- ctest -j `getconf _NPROCESSORS_ONLN` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters