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

Add gh action for crossdock and crossdock otel ci jobs #2681

Merged
merged 5 commits into from
Dec 6, 2020
Merged
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
18 changes: 18 additions & 0 deletions .github/actions/setup-branch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Setup BRANCH'
description: 'Make BRANCH var accessible to job'
runs:
using: "composite"
steps:
- name: Setup BRANCH
shell: bash
run: |
case ${GITHUB_EVENT_NAME} in
pull_request)
BRANCH=${GITHUB_HEAD_REF}
;;
push)
BRANCH=${GITHUB_REF##*/}
;;
esac
echo "we are on branch=${BRANCH}"
echo "BRANCH=${BRANCH}" >> ${GITHUB_ENV}
13 changes: 2 additions & 11 deletions .github/workflows/ci-all-in-one-build.yml
Original file line number Diff line number Diff line change
@@ -40,17 +40,8 @@ jobs:
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
if: steps.dockerhub-login.outcome == 'success'

- name: Export BRANCH variable for pull_request event
run: |
export BRANCH=${GITHUB_HEAD_REF}
echo "we are on branch=$BRANCH"
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
if: github.event_name == 'pull_request'

- name: Export BRANCH variable for push event
run: |
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
if: github.event_name == 'push'
- name: Export BRANCH variable
uses: ./.github/actions/setup-branch

- name: Install tools
run: make install-ci
58 changes: 58 additions & 0 deletions .github/workflows/ci-crossdock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CIT Crossdock

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
crossdock:
runs-on: ubuntu-latest
strategy:
matrix:
steps:
- name: crossdock
cmd: bash scripts/travis/build-crossdock.sh
- name: crossdock-otel
cmd: make build-crossdock crossdock-otel
name: ${{ matrix.steps.name }}
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Fetch git tags
run: |
git fetch --prune --unshallow --tags

- uses: actions/setup-go@v2
with:
go-version: ^1.15

- uses: docker/login-action@v1
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved
id: dockerhub-login
with:
username: jaegertracingbot
password: ${{ secrets.DOCKERHUB_TOKEN }}
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
if: env.DOCKERHUB_TOKEN != null

- name: Export DOCKERHUB_LOGIN variable
run: |
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
if: steps.dockerhub-login.outcome == 'success'

- name: Export BRANCH variable
uses: ./.github/actions/setup-branch

- name: Install tools
run: make install-ci

- name: Build, test, and publish ${{ matrix.steps.name }} image
run: ${{ matrix.steps.cmd }}

- name: Output crossdock logs
run: make crossdock-logs
if: ${{ failure() }}
10 changes: 5 additions & 5 deletions scripts/travis/build-crossdock.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/bin/bash

set -e
set -euxf -o pipefail

BRANCH=${BRANCH:?'missing BRANCH env var'}
DOCKERHUB_LOGIN=${DOCKERHUB_LOGIN:-false}
COMMIT=${GITHUB_SHA::8}

make build-and-run-crossdock

# Only push the docker container to Docker Hub for master branch
if [[ "$BRANCH" == "master" && "$TRAVIS_SECURE_ENV_VARS" == "true" ]]; then
# Only push the docker container to Docker Hub for master branch and when dockerhub login is done
if [[ "$BRANCH" == "master" && "$DOCKERHUB_LOGIN" == "true" ]]; then
echo 'upload to Docker Hub'
else
echo 'skip docker upload for PR'
exit 0
fi

set -x

# docker image has been build when running the crossdock
export REPO=jaegertracing/test-driver
docker tag $REPO:latest $REPO:$COMMIT