Skip to content

Commit

Permalink
Merge pull request #1 from ika-rwth-aachen/feature/github-action
Browse files Browse the repository at this point in the history
Enable docker-ros GitHub action
  • Loading branch information
jpbusch authored Jun 8, 2023
2 parents b0f20b4 + 999b92c commit fec7ee1
Show file tree
Hide file tree
Showing 17 changed files with 1,129 additions and 322 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: GitHub

on: [push]

jobs:

trigger-ros:
runs-on: ubuntu-latest
steps:
- uses: convictional/[email protected]
with:
owner: ika-rwth-aachen
repo: docker-ros-ci
ref: main
workflow_file_name: ros.yml
client_payload: '{"docker-ros-git-ref": "${{ github.sha }}"}'
github_token: ${{ secrets.DOCKER_ROS_CI_TRIGGER_GITHUB_TOKEN }}

trigger-ros2:
runs-on: ubuntu-latest
steps:
- uses: convictional/[email protected]
with:
owner: ika-rwth-aachen
repo: docker-ros-ci
ref: main
workflow_file_name: ros2.yml
client_payload: '{"docker-ros-git-ref": "${{ github.sha }}"}'
github_token: ${{ secrets.DOCKER_ROS_CI_TRIGGER_GITHUB_TOKEN }}
77 changes: 77 additions & 0 deletions .github/workflows/gitlab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: GitLab

on: [push]

jobs:

trigger-ros:
runs-on: ubuntu-latest
steps:
- name: Trigger pipeline
run: |
curl --silent --fail --request POST --form "token=${{ secrets.DOCKER_ROS_CI_TRIGGER_GITLAB_TOKEN }}" --form "ref=main" --form "variables[DOCKER_ROS_GIT_REF]=${{ github.sha }}" "https://gitlab.ika.rwth-aachen.de/api/v4/projects/1886/trigger/pipeline" | jq -r .id > id
- name: Upload pipeline ID
uses: actions/upload-artifact@v3
with:
name: id
path: id

watch-ros:
runs-on: ubuntu-latest
needs: trigger-ros
steps:
- name: Get pipeline ID
uses: actions/download-artifact@v3
with:
name: id
- name: Wait for pipeline completion
run: |
PIPELINE_ID=$(cat id)
while true; do
sleep 30
PIPELINE_STATUS=$(curl --silent --header "PRIVATE-TOKEN: ${{ secrets.DOCKER_ROS_CI_READ_PIPELINE_GITLAB_TOKEN }}" "https://gitlab.ika.rwth-aachen.de/api/v4/projects/1886/pipelines/$PIPELINE_ID" | jq -r .status)
echo "Pipeline status: $PIPELINE_STATUS (https://gitlab.ika.rwth-aachen.de/fb-fi/ops/docker-ros-ci/-/pipelines/$PIPELINE_ID)"
if [[ $PIPELINE_STATUS == "success" ]]; then
break
elif [[ $PIPELINE_STATUS == "failed" ]]; then
exit 1
elif [[ $PIPELINE_STATUS == "canceled" ]]; then
exit 1
fi
done
trigger-ros2:
runs-on: ubuntu-latest
steps:
- name: Trigger pipeline
run: |
curl --silent --fail --request POST --form "token=${{ secrets.DOCKER_ROS_CI_TRIGGER_GITLAB_TOKEN }}" --form "ref=ros2" --form "variables[DOCKER_ROS_GIT_REF]=${{ github.sha }}" "https://gitlab.ika.rwth-aachen.de/api/v4/projects/1886/trigger/pipeline" | jq -r .id > id
- name: Upload pipeline ID
uses: actions/upload-artifact@v3
with:
name: id
path: id

watch-ros2:
runs-on: ubuntu-latest
needs: trigger-ros2
steps:
- name: Get pipeline ID
uses: actions/download-artifact@v3
with:
name: id
- name: Wait for pipeline completion
run: |
PIPELINE_ID=$(cat id)
while true; do
sleep 30
PIPELINE_STATUS=$(curl --silent --header "PRIVATE-TOKEN: ${{ secrets.DOCKER_ROS_CI_READ_PIPELINE_GITLAB_TOKEN }}" "https://gitlab.ika.rwth-aachen.de/api/v4/projects/1886/pipelines/$PIPELINE_ID" | jq -r .status)
echo "Pipeline status: $PIPELINE_STATUS (https://gitlab.ika.rwth-aachen.de/fb-fi/ops/docker-ros-ci/-/pipelines/$PIPELINE_ID)"
if [[ $PIPELINE_STATUS == "success" ]]; then
break
elif [[ $PIPELINE_STATUS == "failed" ]]; then
exit 1
elif [[ $PIPELINE_STATUS == "canceled" ]]; then
exit 1
fi
done
54 changes: 0 additions & 54 deletions .gitlab-ci.yml

This file was deleted.

Loading

0 comments on commit fec7ee1

Please sign in to comment.