Skip to content

refactor name

refactor name #11

Workflow file for this run

# this is our action playground which is triggered whenever this file is changes
name: playground
on:
push:
paths: [ '.github/workflows/playground.yml' ]
env:
CONFLUENT_TOPIC: angkor.system.dev
jobs:
build-playground:
name: Build Playground
strategy:
matrix:
# platform: [ubuntu-latest, macos-latest, windows-latest]
platform: [ubuntu-latest]
runs-on: ${{matrix.platform}}
steps:
- name: Send Kafka Publish Event with Docker
id: send-kafka-pub-event-playground
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) # run only on main
run: |
docker run -e KAFKA_PRODUCER_TOPIC_URL="${{secrets.KAFKA_PRODUCER_TOPIC_URL}}" -e KAFKA_PRODUCER_API_SECRET="${{secrets.KAFKA_PRODUCER_API_SECRET}}" ghcr.io/tillkuhn/rubin:latest \
-ce -key "$GITHUB_REPOSITORY/$GITHUB_JOB" -header "producer=rubin" \
-source "urn:ci:$GITHUB_REPOSITORY:$GITHUB_WORKFLOW:$GITHUB_JOB" \
-type "net.timafe.event.ci.published.v1" -subject "${GITHUB_REPOSITORY}-infra" \
-record "{\"version\":\"${GITHUB_REF#refs/*/}\",\"commit\":\"$GITHUB_SHA\",\"actor\":\"$GITHUB_ACTOR\",\"action\":\"$GITHUB_ACTION\",\"run_url\":\"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}"
- name: Install latest rubin Kafka Record Producer
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) # run only on main
run: |
curl -LsSo ${{ runner.temp }}/rubin.zip $(curl -LsS 'https://api.github.com/repos/tillkuhn/rubin/releases/latest' | jq -r '.assets[] | select(.name|endswith("linux_amd64.zip")).browser_download_url')
unzip ${{ runner.temp }}/rubin.zip -d ${{ runner.temp }} && chmod u+g ${{ runner.temp }}/rubin
- name: Publish additional Kafka Event with CLI
id: test-kafka-messaging
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) # run only on main
run: |
${{ runner.temp }}/rubin -ce -key "${GITHUB_REPOSITORY}/$GITHUB_JOB" \
-source "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
-type "net.timafe.event.ci.published.v1" -subject "${{ secrets.DOCKER_USERNAME }}/angkor-ui:latest" \
-record "{\"cognito\":\"${{secrets.SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_COGNITO_ISSUER_URI}}\",\"version\":\"${GITHUB_REF#refs/*/}\",\"commit\":\"$GITHUB_SHA\",\"repository\":\"$GITHUB_REPOSITORY\",\"actor\":\"$GITHUB_ACTOR\"}" \
-header "producer=rubin"
env:
KAFKA_PRODUCER_TOPIC_URL: ${{ secrets.KAFKA_PRODUCER_TOPIC_URL }}
KAFKA_PRODUCER_API_SECRET: ${{ secrets.KAFKA_PRODUCER_API_SECRET }}
# # test hcp secrets integration
# - shell: bash
# env:
# # shared with HCP Vault
# CONFLUENT_CLUSTER_ID: ${{ secrets.CONFLUENT_CLUSTER_ID }}
# CONFLUENT_CLUSTER_REST_ENDPOINT: ${{ secrets.CONFLUENT_CLUSTER_REST_ENDPOINT }}
# CONFLUENT_PRODUCER_BASIC_AUTH: ${{ secrets.CONFLUENT_PRODUCER_BASIC_AUTH }}
# # default variables: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
# # optimize json quoting https://superuser.com/questions/1650325/setting-variable-inside-curl-json-request-with-single-quotes-in-bash
# run: |
# curl -isSH "Content-Type:application/json" -H "Authorization:Basic $CONFLUENT_PRODUCER_BASIC_AUTH" \
# "$CONFLUENT_CLUSTER_REST_ENDPOINT/kafka/v3/clusters/$CONFLUENT_CLUSTER_ID/topics/$CONFLUENT_TOPIC/records" \
# -d '{"key":{"type":"BINARY","data":"'$key'"},"value":{"type":"JSON","data":{"sha":"'$GITHUB_SHA'","workflow":"'$GITHUB_WORKFLOW'"}}}'