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 github actions for hotrod ci job #2702

Merged
merged 1 commit into from
Dec 24, 2020
Merged
Show file tree
Hide file tree
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
46 changes: 46 additions & 0 deletions .github/workflows/ci-hotrod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CIT Hotrod

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

jobs:
hotrod:
runs-on: ubuntu-latest
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
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 hotrod image
run: bash scripts/travis/hotrod-integration-test.sh
10 changes: 5 additions & 5 deletions scripts/travis/hotrod-integration-test.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash

set -e
set -euxf -o pipefail

make docker-hotrod
export REPO=jaegertracing/example-hotrod

export CID=$(docker run -d -p 8080:8080 $REPO:latest)
i=0
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8080)" != "200" && ${i} < 5 ]]; do
Expand All @@ -19,13 +18,14 @@ fi
docker rm -f $CID

BRANCH=${BRANCH:?'missing BRANCH env var'}
# Only push images to Docker Hub for master branch or for release tags vM.N.P
if [[ ("$BRANCH" == "master" || $BRANCH =~ ^v[0-9]+\.[0-9]+\.[0-9]+$) && "$TRAVIS_SECURE_ENV_VARS" == "true" ]]; then
DOCKERHUB_LOGIN=${DOCKERHUB_LOGIN:-false}

# Only push images to Docker Hub for master branch or for release tags vM.N.P and when dockerhub login is done
if [[ ("$BRANCH" == "master" || $BRANCH =~ ^v[0-9]+\.[0-9]+\.[0-9]+$) && "$DOCKERHUB_LOGIN" == "true" ]]; then
echo "upload to Docker Hub, BRANCH=$BRANCH"
else
echo "skip Docker upload, only allowed for tagged releases or master (latest tag)"
exit 0
fi

bash ./scripts/travis/upload-to-docker.sh