CI: use docker-login action in sub_build_image.yml #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main - reports to https://staging.app.kosli.com | |
on: | |
push: | |
branches: | |
- main | |
env: | |
KOSLI_DRY_RUN: "False" # "True" | |
KOSLI_CLI_VERSION: "2.6.11" | |
KOSLI_HOST: "https://staging.app.kosli.com" | |
KOSLI_ORG: cyber-dojo | |
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }} | |
KOSLI_FLOW: differ | |
jobs: | |
setup-ci-vars: | |
runs-on: ubuntu-latest | |
outputs: | |
kosli_dry_run: ${{ steps.ci_vars.outputs.kosli_dry_run }} | |
kosli_cli_version: ${{ steps.ci_vars.outputs.kosli_cli_version }} | |
kosli_host: ${{ steps.ci_vars.outputs.kosli_host }} | |
kosli_org: ${{ steps.ci_vars.outputs.kosli_org }} | |
kosli_flow: ${{ steps.ci_vars.outputs.kosli_flow }} | |
image_tag: ${{ steps.ci_vars.outputs.image_tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare | |
id: ci_vars | |
run: | | |
echo "kosli_dry_run=${{ env.KOSLI_DRY_RUN }}" >> ${GITHUB_OUTPUT} | |
echo "kosli_cli_version=${{ env.KOSLI_CLI_VERSION }}" >> ${GITHUB_OUTPUT} | |
echo "kosli_host=${{ env.KOSLI_HOST }}" >> ${GITHUB_OUTPUT} | |
echo "kosli_org=${{ env.KOSLI_ORG }}" >> ${GITHUB_OUTPUT} | |
echo "kosli_flow=${{ env.KOSLI_FLOW }}" >> ${GITHUB_OUTPUT} | |
echo "image_tag=$(echo $GITHUB_SHA | head -c7)" >> ${GITHUB_OUTPUT} | |
create-kosli-flow: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Kosli CLI | |
uses: kosli-dev/setup-cli-action@v2 | |
with: | |
version: | |
${{ env.KOSLI_CLI_VERSION }} | |
- name: Create Kosli flow | |
run: | |
kosli create flow ${{ env.KOSLI_FLOW }} | |
--description="Diff files from two traffic-lights" | |
--template=artifact,lint,branch-coverage,snyk-scan | |
wait-for-image: | |
needs: [create-kosli-flow] | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_PASS: ${{ secrets.DOCKER_PASS }} | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Wait for image to be built in main.yml | |
run: | | |
./sh/wait_for_image.sh | |
- name: Setup Kosli CLI | |
uses: kosli-dev/setup-cli-action@v2 | |
with: | |
version: | |
${{ env.KOSLI_CLI_VERSION }} | |
- name: Report image to Kosli flow | |
run: | | |
IMAGE_TAG="$(echo $GITHUB_SHA | head -c7)" | |
docker pull cyberdojo/differ:${IMAGE_TAG} | |
kosli report artifact cyberdojo/differ:${IMAGE_TAG} \ | |
--artifact-type=docker | |
test: | |
needs: [setup-ci-vars, create-kosli-flow, wait-for-image] | |
uses: cyber-dojo/differ/.github/workflows/sub_test.yml@main | |
secrets: | |
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }} | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
with: | |
KOSLI_DRY_RUN: ${{ needs.setup-ci-vars.outputs.kosli_dry_run }} | |
KOSLI_CLI_VERSION: ${{ needs.setup-ci-vars.outputs.kosli_cli_version }} | |
KOSLI_HOST: ${{ needs.setup-ci-vars.outputs.kosli_host }} | |
KOSLI_ORG: ${{ needs.setup-ci-vars.outputs.kosli_org }} | |
KOSLI_FLOW: ${{ needs.setup-ci-vars.outputs.kosli_flow }} | |
IMAGE_TAG: ${{ needs.setup-ci-vars.outputs.image_tag }} | |