Skip to content

Commit

Permalink
CI: turn off CircleCI; switch from merkely to kosli
Browse files Browse the repository at this point in the history
  • Loading branch information
JonJagger committed Aug 20, 2022
1 parent 2636c95 commit fe2208e
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 46 deletions.
File renamed without changes.
37 changes: 20 additions & 17 deletions .circleci/merkely_log_deployment.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
#!/bin/bash -Eeu

readonly MERKELY_CHANGE=merkely/change:latest
readonly MERKELY_OWNER=cyber-dojo
readonly MERKELY_PIPELINE=runner

# - - - - - - - - - - - - - - - - - - -
merkely_log_deployment()
kosli_fingerprint()
{
echo "docker://${CYBER_DOJO_RUNNER_IMAGE}:${CYBER_DOJO_RUNNER_TAG}"
}

# - - - - - - - - - - - - - - - - - - -
kosli_log_deployment()
{
local -r MERKELY_ENVIRONMENT="${1}"
local -r MERKELY_HOST="${2}"
local -r MERKELY_OWNER=cyber-dojo
local -r MERKELY_PIPELINE=runner

# Set CYBER_DOJO_RUNNER_IMAGE, CYBER_DOJO_RUNNER_TAG
local -r VERSIONER_URL=https://raw.githubusercontent.com/cyber-dojo/versioner/master
export $(curl "${VERSIONER_URL}/app/.env")
local -r CYBER_DOJO_RUNNER_TAG="${CIRCLE_SHA1:0:7}"

# Ensure merkely_fingerprint() works
docker pull ${CYBER_DOJO_RUNNER_IMAGE}:${CYBER_DOJO_RUNNER_TAG}

docker run \
--env MERKELY_COMMAND=log_deployment \
--env MERKELY_OWNER=${MERKELY_OWNER} \
--env MERKELY_PIPELINE=${MERKELY_PIPELINE} \
--env MERKELY_FINGERPRINT=$(merkely_fingerprint) \
--env MERKELY_DESCRIPTION="Deployed to ${environment} in circleci pipeline" \
--env MERKELY_FINGERPRINT=$(kosli_fingerprint) \
--env MERKELY_DESCRIPTION="Deployed to ${MERKELY_ENVIRONMENT} in Github Actions pipeline" \
--env MERKELY_ENVIRONMENT="${MERKELY_ENVIRONMENT}" \
--env MERKELY_CI_BUILD_URL=${CIRCLE_BUILD_URL} \
--env MERKELY_API_TOKEN=${MERKELY_API_TOKEN} \
Expand All @@ -33,7 +32,11 @@ merkely_log_deployment()
}

# - - - - - - - - - - - - - - - - - - -
merkely_fingerprint()
{
echo "docker://${CYBER_DOJO_RUNNER_IMAGE}:${CYBER_DOJO_RUNNER_TAG}"
}
VERSIONER_URL=https://raw.githubusercontent.com/cyber-dojo/versioner/master
export $(curl "${VERSIONER_URL}/app/.env")
export CYBER_DOJO_RUNNER_TAG="${CIRCLE_SHA1:0:7}"
docker pull ${CYBER_DOJO_RUNNER_IMAGE}:${CYBER_DOJO_RUNNER_TAG}

readonly ENVIRONMENT="${1}"
readonly HOSTNAME="${2}"
kosli_log_deployment "${ENVIRONMENT}" "${HOSTNAME}"
12 changes: 5 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ jobs:
gh_actions_iam_role_name: gh_actions_services
environment_url: https://beta.cyber-dojo.org
environment_name: staging
cyber_dojo_env_name: beta
cyber_dojo_env_name_aws: aws-beta
kosli_staging_host: https://staging.app.merkely.com
kosli_production_host: https://app.merkely.com
kosli_staging_host: https://staging.app.kosli.com
kosli_production_host: https://app.kosli.com
circle_sha1: ${{ github.sha }}
circle_build_url: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}

Expand All @@ -70,9 +69,8 @@ jobs:
gh_actions_iam_role_name: gh_actions_services
environment_url: https://prod.cyber-dojo.org
environment_name: production
cyber_dojo_env_name: prod
cyber_dojo_env_name_aws: aws-prod
kosli_staging_host: https://staging.app.merkely.com
kosli_production_host: https://app.merkely.com
cyber_dojo_env_name_aws: aws-beta
kosli_staging_host: https://staging.app.kosli.com
kosli_production_host: https://app.kosli.com
circle_sha1: ${{ github.sha }}
circle_build_url: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2021, [CyberDojo Foundation](http://blog.cyber-dojo.org/2015/08/cyber-dojo-foundation.html)
Copyright (c) 2022, [CyberDojo Foundation](http://blog.cyber-dojo.org/2015/08/cyber-dojo-foundation.html)
All rights reserved.


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![CircleCI](https://circleci.com/gh/cyber-dojo/runner.svg?style=svg)](https://circleci.com/gh/cyber-dojo/runner)
![Github Action (main)](https://github.com/cyber-dojo/runner/actions/workflows/main.yml/badge.svg)

- The source for the [cyberdojo/runner](https://hub.docker.com/r/cyberdojo/runner/tags) Docker image.
- A docker-containerized micro-service for [https://cyber-dojo.org](https://cyber-dojo.org).
Expand Down
8 changes: 4 additions & 4 deletions build_test_publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source "${SH_DIR}/exit_zero_if_build_only.sh"
source "${SH_DIR}/exit_zero_if_show_help.sh"
source "${SH_DIR}/exit_non_zero_unless_installed.sh"
source "${SH_DIR}/on_ci_publish_tagged_images.sh"
source "${SH_DIR}/merkely.sh"
source "${SH_DIR}/kosli.sh"
source "${SH_DIR}/remove_old_images.sh"
source "${SH_DIR}/remove_zombie_containers.sh"
source "${SH_DIR}/setup_dependent_images.sh"
Expand All @@ -26,7 +26,7 @@ exit_non_zero_unless_installed docker
exit_non_zero_unless_installed docker-compose
exit_non_zero_unless_installed jq
remove_old_images
on_ci_merkely_declare_pipeline
on_ci_kosli_declare_pipeline
build_tagged_images "$@"
exit_zero_if_build_only "$@"
remove_zombie_containers
Expand All @@ -36,7 +36,7 @@ create_test_data_manifests_file
server_up_healthy_and_clean
client_up_healthy_and_clean "$@"
on_ci_publish_tagged_images
on_ci_merkely_log_artifact
on_ci_kosli_log_artifact
test_in_containers "$@"
on_ci_merkely_log_evidence
on_ci_kosli_log_evidence
containers_down
32 changes: 16 additions & 16 deletions scripts/merkely.sh → scripts/kosli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ readonly MERKELY_OWNER=cyber-dojo
readonly MERKELY_PIPELINE=runner

# - - - - - - - - - - - - - - - - - - -
merkely_fingerprint()
kosli_fingerprint()
{
echo "docker://${CYBER_DOJO_RUNNER_IMAGE}:${CYBER_DOJO_RUNNER_TAG}"
}

# - - - - - - - - - - - - - - - - - - -
merkely_declare_pipeline()
kosli_declare_pipeline()
{
local -r hostname="${1}"

Expand All @@ -29,15 +29,15 @@ merkely_declare_pipeline()
}

# - - - - - - - - - - - - - - - - - - -
merkely_log_artifact()
kosli_log_artifact()
{
local -r hostname="${1}"

docker run \
--env MERKELY_COMMAND=log_artifact \
--env MERKELY_OWNER=${MERKELY_OWNER} \
--env MERKELY_PIPELINE=${MERKELY_PIPELINE} \
--env MERKELY_FINGERPRINT=$(merkely_fingerprint) \
--env MERKELY_FINGERPRINT=$(kosli_fingerprint) \
--env MERKELY_IS_COMPLIANT=TRUE \
--env MERKELY_ARTIFACT_GIT_COMMIT=${CYBER_DOJO_RUNNER_SHA} \
--env MERKELY_ARTIFACT_GIT_URL=https://github.com/${MERKELY_OWNER}/${MERKELY_PIPELINE}/commit/${CYBER_DOJO_RUNNER_SHA} \
Expand All @@ -51,15 +51,15 @@ merkely_log_artifact()
}

# - - - - - - - - - - - - - - - - - - -
merkely_log_evidence()
kosli_log_evidence()
{
local -r hostname="${1}"

docker run \
--env MERKELY_COMMAND=log_evidence \
--env MERKELY_OWNER=${MERKELY_OWNER} \
--env MERKELY_PIPELINE=${MERKELY_PIPELINE} \
--env MERKELY_FINGERPRINT=$(merkely_fingerprint) \
--env MERKELY_FINGERPRINT=$(kosli_fingerprint) \
--env MERKELY_EVIDENCE_TYPE=branch-coverage \
--env MERKELY_IS_COMPLIANT=TRUE \
--env MERKELY_DESCRIPTION="server & client branch-coverage reports" \
Expand Down Expand Up @@ -92,37 +92,37 @@ evidence_json_path()
# - - - - - - - - - - - - - - - - - - - - - - - -
on_ci()
{
[ -n "${CIRCLECI:-}" ]
[ -n "${CI:-}" ]
}

# - - - - - - - - - - - - - - - - - - -
on_ci_merkely_declare_pipeline()
on_ci_kosli_declare_pipeline()
{
if ! on_ci ; then
return
fi
merkely_declare_pipeline https://staging.app.merkely.com
merkely_declare_pipeline https://app.merkely.com
kosli_declare_pipeline https://staging.app.kosli.com
kosli_declare_pipeline https://app.kosli.com
}

# - - - - - - - - - - - - - - - - - - -
on_ci_merkely_log_artifact()
on_ci_kosli_log_artifact()
{
if ! on_ci ; then
return
fi
merkely_log_artifact https://staging.app.merkely.com
merkely_log_artifact https://app.merkely.com
kosli_log_artifact https://staging.app.kosli.com
kosli_log_artifact https://app.kosli.com
}

# - - - - - - - - - - - - - - - - - - -
on_ci_merkely_log_evidence()
on_ci_kosli_log_evidence()
{
if ! on_ci ; then
return
fi
write_evidence_json
merkely_log_evidence https://staging.app.merkely.com
merkely_log_evidence https://app.merkely.com
kosli_log_evidence https://staging.app.kosli.com
kosli_log_evidence https://app.kosli.com
}

0 comments on commit fe2208e

Please sign in to comment.