Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
strokyl committed Feb 14, 2024
1 parent 230bd1f commit e6ff208
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 81 deletions.
31 changes: 10 additions & 21 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI Platform / Build Docker Images
name: Build Docker Images

on:
workflow_call:
Expand All @@ -12,30 +12,22 @@ on:
type: boolean
description: (bool) Whether this is a release or not
default: false
amd64_artifact_name:
description: "(string) AMD64 Artifact name"
type: string
required: true
arm64_artifact_name:
description: "(string) ARM64 Artifact name"
type: string
required: true
outputs:
all_conduktor_tags:
description: (json string) All conduktor ctl image tags built (in format repo/namespace/image:tag)
value: ${{ jobs.build-platform-docker.outputs.all_tags }}
value: ${{ jobs.build-docker.outputs.all_tags }}
ghcr_conduktor_tags:
description: (json string) All conduktor ctl GHCR image tags (in format ghcr.io/namespace/image:tag)
value: ${{ jobs.build-platform-docker.outputs.ghcr_tags }}
value: ${{ jobs.build-docker.outputs.ghcr_tags }}
ghcr_conduktor_digest:
description: (string) Only the first conduktor ctl GHCR image digest (in format ghcr.io/namespace/image@sha256:digest)
value: ${{ jobs.build-platform-docker.outputs.ghcr_digest }}
value: ${{ jobs.build-docker.outputs.ghcr_digest }}
harbor_conduktor_tags:
description: (json string) Only the first conduktor image tags (in format harbor.cdkt.dev/namespace/image:tag)
value: ${{ jobs.build-platform-docker.outputs.harbor_tags }}
value: ${{ jobs.build-docker.outputs.harbor_tags }}
harbor_conduktor_digest:
description: (string) Only the first conduktor image digest (in format harbor.cdkt.dev/namespace/image@sha256:digest)
value: ${{ jobs.build-platform-docker.outputs.harbor_digest }}
value: ${{ jobs.build-docker.outputs.harbor_digest }}
env:
GHCR_REGISTRY: "ghcr.io"
HARBOR_REGISTRY: "harbor.cdkt.dev"
Expand All @@ -45,8 +37,7 @@ env:
LABEL_IMAGE_VENDOR: "Conduktor.io"

jobs:

build-platform-docker:
build-docker:
name: Build Platform Docker
runs-on: [cdk-standard]
outputs:
Expand All @@ -59,7 +50,7 @@ jobs:
id-token: write
contents: read
env:
PLATFORM_IMAGE: "conduktorctl"
IMAGE_NAME: "conduktorctl"
GHCR_IMAGE: "ghcr.io/conduktor/conduktorctl"
HARBOR_IMAGE: "harbor.cdkt.dev/conduktor/conduktorctl"
LABEL_IMAGE_TITLE: "Conduktor ctl"
Expand All @@ -84,8 +75,7 @@ jobs:
uses: conduktor/conduktor-actions/[email protected]
with:
image-name: |
${{ env.PLATFORM_IMAGE }}
conduktor-console
${{ env.IMAGE_NAME }}
namespace: ${{ env.NAMESPACE }}
tags: ${{ inputs.image_tags }}
labels: |
Expand All @@ -105,14 +95,13 @@ jobs:
echo "name=conduktorctl" >> "${GITHUB_OUTPUT}"
echo "platforms=linux/amd64,linux/arm64" >> "${GITHUB_OUTPUT}"
- name: Build ${{ env.PLATFORM_IMAGE }} for ${{ steps.buildx.outputs.platforms }}
- name: Build ${{ env.IMAGE_NAME }} for ${{ steps.buildx.outputs.platforms }}
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ steps.buildx.outputs.platforms }}
builder: ${{ steps.buildx.outputs.name }}
pull: true
push: true
file: docker/Dockerfile
tags: ${{ steps.docker_meta.outputs.tags }}
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ jobs:
- uses: actions/checkout@v3
- name: run test
run: ./test_final_exec.sh

build-docker:
name: Build and publish conduktorctl images
uses: ./.github/workflows/build-docker.yml
secrets: inherit
needs: [tags, unit-test, integration-test]
with:
release: false
image_tags: ${GITHUB_SHA}
63 changes: 4 additions & 59 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Release
run-name: ${{ github.event.release.prerelease == true && 'Pre-' || '' }}Release ${{ github.event.release.tag_name }} by ${{ github.actor }}
run-name: Release ${{ github.event.release.tag_name }} by ${{ github.actor }}

on:
release:
Expand All @@ -12,7 +12,6 @@ jobs:
image_tags: ${{ steps.image_tag.outputs.tags }}
version: ${{ steps.image_tag.outputs.version }}
is_latest: ${{ steps.image_tag.outputs.is_latest }}
is_prerelease: ${{ steps.image_tag.outputs.is_prerelease }}
steps:
- name: Debug tags
shell: bash
Expand All @@ -26,7 +25,6 @@ jobs:
echo " name :${{ github.event.release.name }}"
echo " tag_name :${{ github.event.release.tag_name }}"
echo " target_commitish:${{ github.event.release.target_commitish }}"
echo " prerelease:${{ github.event.release.prerelease }}"
echo " draft:${{ github.event.release.draft }}"
- name: Parse version from tag
Expand All @@ -48,21 +46,6 @@ jobs:
echo "RELEASE_TAG=${{ steps.version.outputs.full }}" >> $GITHUB_ENV
echo "IS_LATEST=${is_latest}" >> $GITHUB_ENV
- name: Pre-release check
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Check consistency between pre-release Github flag and git tag name"
if [[ ${{ github.event.release.prerelease }} == true && "${{ steps.version.outputs.prerelease }}" == "" ]]; then
echo "Empty pre-release tag need a git tag like major.minor.patch-<pre_release_name>"
exit 1
fi
if [[ ${{ github.event.release.prerelease }} == false && "${{ steps.version.outputs.prerelease }}" != "" ]]; then
echo "Invalid pre-release tag ${{ steps.version.outputs.full }} not flagged as pre-release on Github Release page"
exit 1
fi
- name: Image tag
id: image_tag
shell: bash
Expand All @@ -77,7 +60,6 @@ jobs:
echo -e "version=${{ steps.version.outputs.full }}" >> "${GITHUB_OUTPUT}"
echo -e "is_latest=${{ env.IS_LATEST }}" >> "${GITHUB_OUTPUT}"
echo -e "is_prerelease=${{ github.event.release.prerelease }}" >> "${GITHUB_OUTPUT}"
echo "Outputs ${GITHUB_OUTPUT}"
echo "-------"
Expand All @@ -100,47 +82,10 @@ jobs:
run: ./test_final_exec.sh

build-docker:
name: Build and publish platform images
name: Build and publish conduktorctl images
uses: ./.github/workflows/build-docker.yml
secrets: inherit
needs: [tags, build-cli, e2e]
needs: [tags, unit-test, integration-test]
with:
release: true
image_tags: ${{ needs.tags.outputs.image_tags }}
amd64_artifact_name: ${{ needs.build-cli.outputs.amd64_artifact_name }}
arm64_artifact_name: ${{ needs.build-cli.outputs.arm64_artifact_name }}

create_maintance_branches:
if: ${{ github.event.release.prerelease == false }}
needs: [ tags, build-docker ]
runs-on: cdk-standard
env:
GITHUB_TOKEN: ${{ secrets.CONDUKTORBOT_GHCR_RW }}
steps:
- name: Parse version from string
id: parsed_version
uses: release-kit/semver@v2
with:
string: "${{ needs.tags.outputs.version }}"

- name: Maintenance Branch Name
id: maintenance_branch_name
shell: bash
run: |
maintenance_branch_name="patch/${{ steps.parsed_version.outputs.major }}.${{ steps.parsed_version.outputs.minor }}"
echo "MAINTENANCE_BRANCH_NAME=${maintenance_branch_name}" >> $GITHUB_ENV
echo "MAINTENANCE_TAG_NAME=release-${{ needs.tags.outputs.version }}" >> $GITHUB_ENV
- uses: actions/checkout@v4

- name: Extract dependencies refs
id: dependencies_refs
uses: ./.github/actions/get-dependencies-refs

- name: Platform-build maintenance branch
uses: ./.github/actions/create-patch-branch
with:
repository: ${{ github.repository }}
remote_ref: ${{ github.ref }}
branch_name: ${{ env.MAINTENANCE_BRANCH_NAME }}
token: ${{ secrets.CONDUKTORBOT_GHCR_RW }}
image_tags: ${{ needs.tags.outputs.image_tags }}

0 comments on commit e6ff208

Please sign in to comment.