-
Notifications
You must be signed in to change notification settings - Fork 15
chore: update smurf shared workflows for Docker, Helm, and Terraform, and update the documentation. #405
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
Merged
clouddrove-ci
merged 3 commits into
clouddrove:master
from
anket-cd:feat/smurf-shared-workflows
Jul 15, 2026
Merged
chore: update smurf shared workflows for Docker, Helm, and Terraform, and update the documentation. #405
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,27 @@ | ||
| --- | ||
| name: 🦸♂️ Smurf-Docker | ||
| 'on': | ||
| # Reusable Smurf SDKR workflow — build, scan, and push Docker images. | ||
| # Docs: docs/docker-smurf.md | ||
| name: 🐳 Smurf-Docker | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| # ── General toggles ────────────────────────────────────────────── | ||
| docker_enable: | ||
| description: Set to true to run docker commands | ||
| type: string | ||
| required: false | ||
| aws_auth_method: | ||
| description: AWS auth method to use like oidc and keys | ||
| type: string | ||
| required: false | ||
| aws_eks_cluster_name: | ||
| description: AWS eks cluster name | ||
| docker_push: | ||
| description: Set true for docker push | ||
| type: string | ||
| required: false | ||
| aws_role: | ||
| description: AWS OIDC role for aws authentication. | ||
| type: string | ||
| default: 'false' | ||
| provider: | ||
| description: Cloud provider (aws, azure, gcp, digitalocean) | ||
| type: string | ||
| required: false | ||
| default: aws | ||
|
|
||
| # ── Docker image & build ───────────────────────────────────────── | ||
| docker_image_name: | ||
| description: Docker image name | ||
| type: string | ||
|
|
@@ -37,15 +35,6 @@ name: 🦸♂️ Smurf-Docker | |
| type: string | ||
| required: false | ||
| default: image | ||
| docker_push: | ||
| description: Set true for docker push | ||
| type: string | ||
| required: false | ||
| docker_buildkit_enable: | ||
| description: Set true to enable docker buildkit | ||
| type: string | ||
| required: false | ||
| default: 'false' | ||
| docker_registry: | ||
| description: 'The registry to Push Docker Image (aws, az, gcp, hub)' | ||
| type: string | ||
|
|
@@ -54,7 +43,7 @@ name: 🦸♂️ Smurf-Docker | |
| description: 'The URL of the container registry (e.g., Docker Hub, ECR, GCR, ACR).' | ||
| type: string | ||
| dockerfile_path: | ||
| description: Docker file directory | ||
| description: Docker file path (relative to repo root) | ||
| type: string | ||
| default: Dockerfile | ||
| docker_build_args: | ||
|
|
@@ -66,6 +55,13 @@ name: 🦸♂️ Smurf-Docker | |
| description: Docker Image Build Platform | ||
| type: string | ||
| default: linux/amd64 | ||
| docker_buildkit_enable: | ||
| description: Set true to enable docker buildkit | ||
| type: string | ||
| required: false | ||
| default: 'false' | ||
|
|
||
| # ── AWS ────────────────────────────────────────────────────────── | ||
| aws_region: | ||
| required: false | ||
| type: string | ||
|
|
@@ -80,6 +76,8 @@ name: 🦸♂️ Smurf-Docker | |
| type: string | ||
| description: AWS assume role | ||
| required: false | ||
|
|
||
| # ── GCP ────────────────────────────────────────────────────────── | ||
| gcp_project_id: | ||
| required: false | ||
| type: string | ||
|
|
@@ -93,17 +91,9 @@ name: 🦸♂️ Smurf-Docker | |
| type: string | ||
| required: false | ||
| default: 'false' | ||
| gcp_region: | ||
| required: false | ||
| type: string | ||
| description: GCP Region | ||
| default: 'us-central1' | ||
| gcp_gke_cluster_name: | ||
| description: GCP gke cluster name | ||
| type: string | ||
| required: false | ||
|
|
||
| secrets: | ||
| # ── AWS secrets ────────────────────────────────────────────────── | ||
| AWS_ACCESS_KEY_ID: | ||
| required: false | ||
| description: AWS Access Key ID for direct authentication | ||
|
|
@@ -113,6 +103,11 @@ name: 🦸♂️ Smurf-Docker | |
| AWS_SESSION_TOKEN: | ||
| required: false | ||
| description: AWS Session Token for direct authentication | ||
| BUILD_ROLE: | ||
| required: false | ||
| description: AWS OIDC role for aws authentication | ||
|
|
||
| # ── GCP secrets ────────────────────────────────────────────────── | ||
| GCP_WIP: | ||
| required: false | ||
| description: 'WIP Connected with Service Account' | ||
|
|
@@ -125,11 +120,23 @@ name: 🦸♂️ Smurf-Docker | |
| GCP_SERVICE_ACCOUNT_KEY: | ||
| required: false | ||
| description: 'GCP service account JSON Key' | ||
|
|
||
| # ── Docker Hub secrets ─────────────────────────────────────────── | ||
| DOCKER_USERNAME: | ||
| required: false | ||
| description: Docker Hub username | ||
| DOCKER_PASSWORD: | ||
| required: false | ||
| description: Docker Hub access token or password | ||
|
|
||
| aws_set_parameters: | ||
| required: false | ||
| description: Overriding the default values using --set flag | ||
|
|
||
| jobs: | ||
| ############################################### | ||
| # BUILD → SAVE → UPLOAD ARTIFACT | ||
| ############################################### | ||
| docker_build: | ||
| if: inputs.docker_enable == 'true' | ||
| runs-on: ubuntu-latest | ||
|
|
@@ -140,35 +147,40 @@ jobs: | |
| - name: 📦 Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| # - Setup smurf CLI | ||
| - name: Setup Smurf | ||
| uses: clouddrove/smurf@v1.1.3 | ||
| - name: ⚙️ Setup Smurf | ||
| uses: clouddrove/smurf@v1.1.5 | ||
|
|
||
| - name: 🐳 Docker Image Build | ||
| if: inputs.docker_buildkit_enable != 'true' | ||
| run: | | ||
| smurf sdkr build ${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} -f ${{ | ||
| inputs.dockerfile_path }} --platform ${{ inputs.docker_build_platform }} | ||
| smurf sdkr build ${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} \ | ||
| -f ${{ inputs.dockerfile_path }} \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please corss check indentation here |
||
| --platform ${{ inputs.docker_build_platform }} \ | ||
| --build-arg ${{ inputs.docker_build_args }} | ||
|
|
||
| - name: 🐳 Docker Image Build with Buildkit | ||
| if: inputs.docker_buildkit_enable == 'true' | ||
| run: | | ||
| smurf sdkr build ${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} -f ${{ | ||
| inputs.dockerfile_path }} --platform ${{ inputs.docker_build_platform }} | ||
| --build-arg ${{ inputs.docker_build_args }} --buildkit | ||
| smurf sdkr build ${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} \ | ||
| -f ${{ inputs.dockerfile_path }} \ | ||
| --platform ${{ inputs.docker_build_platform }} \ | ||
| --build-arg ${{ inputs.docker_build_args }} \ | ||
| --buildkit | ||
|
|
||
| - name: 💾 Save Docker Image as Artifact | ||
| run: > | ||
| docker save ${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} -o ${{ | ||
| inputs.docker_image_tar }} | ||
| run: | | ||
| docker save ${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} \ | ||
| -o ${{ inputs.docker_image_tar }} | ||
|
|
||
| - name: ⬆️ Upload Docker Image Artifact | ||
| - name: 📤 Upload Docker Image Artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: '${{ inputs.docker_image_name }}' | ||
| path: '${{ inputs.docker_image_tar }}' | ||
| name: docker-image | ||
| path: ${{ inputs.docker_image_tar }} | ||
|
|
||
| ############################################### | ||
| # DOWNLOAD → AUTH → SCAN → TAG → PUSH | ||
| ############################################### | ||
| docker_scan_push: | ||
| if: inputs.docker_enable == 'true' && inputs.docker_push == 'true' | ||
| runs-on: ubuntu-latest | ||
|
|
@@ -180,19 +192,18 @@ jobs: | |
| - name: 📦 Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| # - Setup smurf CLI | ||
| - name: Setup Smurf | ||
| uses: clouddrove/smurf@v1.1.3 | ||
| - name: ⚙️ Setup Smurf | ||
| uses: clouddrove/smurf@v1.1.5 | ||
|
|
||
| - name: ⬇️ Download Docker Image Artifact | ||
| - name: 📥 Download Docker Image Artifact | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: '${{ inputs.docker_image_name }}' | ||
| name: docker-image | ||
|
|
||
| - name: 📥 Load Docker Image | ||
| run: | | ||
| docker load -i ${{ inputs.docker_image_tar }} | ||
| - name: 📂 Load Docker Image | ||
| run: docker load -i ${{ inputs.docker_image_tar }} | ||
|
|
||
| # ── Cloud authentication ───────────────────────────────────────── | ||
| - name: 🟦 Install AWS CLI | ||
| if: ${{ inputs.provider == 'aws' }} | ||
| uses: aws-actions/configure-aws-credentials@v6 | ||
|
|
@@ -205,7 +216,7 @@ jobs: | |
| role-duration-seconds: 900 | ||
| role-skip-session-tagging: true | ||
|
|
||
| - name: 🔄 Assume another IAM Role | ||
| - name: 🔑 Assume another IAM Role | ||
| if: inputs.aws_assume_role == 'true' | ||
| uses: aws-actions/configure-aws-credentials@v6 | ||
| with: | ||
|
|
@@ -224,29 +235,41 @@ jobs: | |
|
|
||
| - name: ☁️ Authenticate Google Cloud with Service Account JSON Key | ||
| if: inputs.gcp_auth_method == 'json' | ||
| uses: 'google-github-actions/auth@v3' | ||
| uses: google-github-actions/auth@v3 | ||
| with: | ||
| credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' | ||
| credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }} | ||
|
|
||
| - name: 🐋 Set Docker Hub environment variables | ||
| if: inputs.docker_registry == 'hub' | ||
| run: | | ||
| echo "DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }}" >> $GITHUB_ENV | ||
| echo "DOCKER_PASSWORD=${{ secrets.DOCKER_PASSWORD }}" >> $GITHUB_ENV | ||
| shell: bash | ||
|
|
||
| # ── Scan & push ────────────────────────────────────────────────── | ||
| - name: 🛡️ Install Trivy | ||
| run: | | ||
| curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin | ||
| trivy --version | ||
|
|
||
| - name: 🛡️ Docker Image Scan | ||
| - name: 🔍 Docker Image Scan | ||
| run: | | ||
| smurf sdkr scan ${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} | ||
|
|
||
| - name: 🏷️ Docker Image Tag | ||
| if: inputs.docker_push == 'true' | ||
| run: | | ||
| smurf sdkr tag ${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} ${{ | ||
| inputs.docker_registry_url }}/${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} | ||
| smurf sdkr tag ${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} \ | ||
| ${{ inputs.docker_registry_url }}/${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} | ||
|
|
||
| - name: 🚀 Docker Image Push | ||
| if: inputs.docker_push == 'true' && inputs.gcp_docker_push != 'true' | ||
| if: inputs.docker_push == 'true' && inputs.gcp_docker_push != 'true' | ||
| run: | | ||
| smurf sdkr push ${{ inputs.docker_registry }} ${{ inputs.docker_registry_url }}/${{ inputs.docker_image_name }}:${{ | ||
| inputs.docker_image_tag }} | ||
| smurf sdkr push ${{ inputs.docker_registry }} ${{ inputs.docker_registry_url }}/${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} | ||
|
|
||
| - name: 🚀 Docker Image Push on gcp | ||
| - name: 🚀 Docker Image Push on GCP | ||
| if: inputs.docker_push == 'true' && inputs.gcp_docker_push == 'true' | ||
| run: | | ||
| smurf sdkr push ${{ inputs.docker_registry }} ${{ inputs.docker_registry_url }}/${{ inputs.docker_image_name }}:${{ | ||
| inputs.docker_image_tag }} --project-id ${{ inputs.gcp_project_id }} | ||
| ... | ||
| smurf sdkr push ${{ inputs.docker_registry }} \ | ||
| ${{ inputs.docker_registry_url }}/${{ inputs.docker_image_name }}:${{ inputs.docker_image_tag }} \ | ||
| --project-id ${{ inputs.gcp_project_id }} | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make it AWS_BUILD_ROLE