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

Use cron jobs from Circleci to trigger Docker Hub builds #312

Closed
wants to merge 9 commits into from
Closed
Changes from all 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
84 changes: 84 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
version: 2.1

references:
trigger_osrf_ros2_nightly: &trigger_osrf_ros2_nightly
trigger_docker_hub:
url: ${DOCKER_TRIGGER_URL_ROS2}
data: >-
'{"docker_tag": "nightly"}'
trigger_osrf_ros2_devel: &trigger_osrf_ros2_devel
trigger_docker_hub:
url: ${DOCKER_TRIGGER_URL_ROS2}
data: >-
'{"docker_tag": "devel"}'

commands:
trigger_docker_hub:
description: "Trigger Docker Hub"
parameters:
data:
type: string
url:
type: string
steps:
- run:
name: Trigger Docker Hub
command: |
curl --request POST \
--header "Content-Type: application/json" \
--data << parameters.data >> \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these parameters masked out of the build log and is the build log public or just the build status?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build logs are public for public repos, but environment variables are not expanded prior to logging the contents of the run script, nor is the token printed to stdout by the return message from the POST request. I'm not sure CircleCI masks secrets yet, it was a requested feature last I checked. But that won't be an issue here. Example:
https://circleci.com/gh/ruffsl/docker_images/23

--url << parameters.url >> \
> /dev/null && true
when: always

executors:
docker_exec:
docker:
- image: circleci/python

jobs:
osrf_ros2:
executor: docker_exec
steps:
- *trigger_osrf_ros2_nightly
- *trigger_osrf_ros2_devel
osrf_ros2_nightly:
executor: docker_exec
steps:
- *trigger_osrf_ros2_nightly
osrf_ros2_devel:
executor: docker_exec
steps:
- *trigger_osrf_ros2_devel

workflows:
version: 2
deploy:
jobs:
- osrf_ros2:
context: dockerhub
filters:
branches:
only: master
nightly:
jobs:
- osrf_ros2_nightly:
context: dockerhub
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
daily:
jobs:
- osrf_ros2_devel:
context: dockerhub
triggers:
- schedule:
cron: "0 12 * * *"
filters:
branches:
only:
- master