-
Notifications
You must be signed in to change notification settings - Fork 126
draft: modularize workflow and test #1613
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
base: main
Are you sure you want to change the base?
Changes from all commits
da658a1
caaaa82
dba488a
1cff270
8ed2355
6b6b8bb
d9dc927
539d171
ced782c
b52dd19
db39fea
c90969c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,58 @@ | ||||||
| name: 'Build and Sign Container Image' | ||||||
| description: 'Build Docker image, push to registry, and sign with Cosign' | ||||||
|
|
||||||
| inputs: | ||||||
| image-name: | ||||||
| description: 'Full image name with tag (registry/repo:tag)' | ||||||
| required: true | ||||||
| dockerfile: | ||||||
| description: 'Path to Dockerfile' | ||||||
| required: false | ||||||
| default: './Dockerfile' | ||||||
| context: | ||||||
| description: 'Build context path' | ||||||
| required: false | ||||||
| default: '.' | ||||||
| sign-image: | ||||||
| description: 'Sign image with cosign' | ||||||
| required: false | ||||||
| default: 'true' | ||||||
| cosign-private-key: | ||||||
| description: 'Cosign private key' | ||||||
| required: false | ||||||
| cosign-password: | ||||||
| description: 'Cosign password' | ||||||
| required: false | ||||||
| build-args: | ||||||
| description: 'Additional build arguments' | ||||||
| required: false | ||||||
| default: '' | ||||||
|
|
||||||
| runs: | ||||||
| using: 'composite' | ||||||
| steps: | ||||||
| - name: Set up Docker Buildx | ||||||
| uses: docker/setup-buildx-action@v3 | ||||||
|
|
||||||
| - name: Build and Push Image | ||||||
| shell: bash | ||||||
| run: | | ||||||
| make docker-buildx IMG=${{ inputs.image-name }} ${{ inputs.build-args }} | ||||||
|
|
||||||
| - name: Set up Cosign | ||||||
| if: inputs.sign-image == 'true' | ||||||
| uses: sigstore/cosign-installer@main | ||||||
|
||||||
| uses: sigstore/cosign-installer@main | |
| uses: sigstore/cosign-installer@v3.5.0 |
Copilot
AI
Nov 18, 2025
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.
The outputs section is defined but there's no step with id: build that sets the digest output. The build step doesn't have an id, so ${{ steps.build.outputs.digest }} will always be empty. Either add an id: build to the "Build and Push Image" step and ensure it outputs the digest, or remove the unused outputs section.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: 'Collect Test Artifacts' | ||
| description: 'Collect and upload pod logs and test artifacts' | ||
|
|
||
| inputs: | ||
| artifact-name: | ||
| description: 'Name for the artifact' | ||
| required: true | ||
| log-path: | ||
| description: 'Path to collect logs from' | ||
| required: false | ||
| default: './test' | ||
| additional-paths: | ||
| description: 'Additional paths to collect (newline separated)' | ||
| required: false | ||
| default: '' | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Collect Test Logs | ||
| if: always() | ||
| shell: bash | ||
| run: | | ||
| mkdir -p /tmp/pod_logs | ||
| find ${{ inputs.log-path }} -name "*.log" -exec cp {} /tmp/pod_logs \; 2>/dev/null || true | ||
|
|
||
| # Collect additional paths if specified | ||
| if [ -n "${{ inputs.additional-paths }}" ]; then | ||
| while IFS= read -r path; do | ||
| [ -n "$path" ] && cp -r "$path" /tmp/pod_logs/ 2>/dev/null || true | ||
| done <<< "${{ inputs.additional-paths }}" | ||
| fi | ||
|
|
||
| - name: Archive Artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ inputs.artifact-name }} | ||
| path: /tmp/pod_logs/** | ||
| retention-days: 7 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: 'Configure Cloud Provider Authentication' | ||
| description: 'Setup authentication for AWS, Azure, or GCP' | ||
|
|
||
| inputs: | ||
| cloud-provider: | ||
| description: 'Cloud provider: aws, azure, or gcp' | ||
| required: true | ||
| aws-access-key-id: | ||
| description: 'AWS Access Key ID' | ||
| required: false | ||
| aws-secret-access-key: | ||
| description: 'AWS Secret Access Key' | ||
| required: false | ||
| aws-region: | ||
| description: 'AWS Region' | ||
| required: false | ||
| azure-credentials: | ||
| description: 'Azure credentials JSON' | ||
| required: false | ||
| gcp-service-account-key: | ||
| description: 'GCP service account key JSON' | ||
| required: false | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Configure AWS credentials | ||
| if: inputs.cloud-provider == 'aws' | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-access-key-id: ${{ inputs.aws-access-key-id }} | ||
| aws-secret-access-key: ${{ inputs.aws-secret-access-key }} | ||
| aws-region: ${{ inputs.aws-region }} | ||
|
|
||
| - name: Login to Amazon ECR | ||
| if: inputs.cloud-provider == 'aws' | ||
| uses: aws-actions/amazon-ecr-login@v2 | ||
|
|
||
| - name: Azure Login | ||
| if: inputs.cloud-provider == 'azure' | ||
| uses: azure/login@v2 | ||
| with: | ||
| creds: ${{ inputs.azure-credentials }} | ||
|
|
||
| - name: GCP Authentication | ||
| if: inputs.cloud-provider == 'gcp' | ||
| uses: google-github-actions/auth@v2 | ||
| with: | ||
| credentials_json: ${{ inputs.gcp-service-account-key }} | ||
|
|
||
| - name: Setup gcloud | ||
| if: inputs.cloud-provider == 'gcp' | ||
| uses: google-github-actions/setup-gcloud@v2 |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||
| name: 'Setup Kubernetes Tools' | ||||||
| description: 'Install kubectl, helm, eksctl, and other Kubernetes tools' | ||||||
|
|
||||||
| inputs: | ||||||
| kubectl-version: | ||||||
| description: 'Kubectl version' | ||||||
| required: true | ||||||
| helm-version: | ||||||
| description: 'Helm version' | ||||||
| required: false | ||||||
| default: 'v3.8.2' | ||||||
| eksctl-version: | ||||||
| description: 'eksctl version' | ||||||
| required: false | ||||||
| install-metrics-server: | ||||||
| description: 'Install metrics server' | ||||||
| required: false | ||||||
| default: 'false' | ||||||
|
|
||||||
| runs: | ||||||
| using: 'composite' | ||||||
| steps: | ||||||
| - name: Install Kubectl | ||||||
| uses: Azure/setup-kubectl@v4 | ||||||
| with: | ||||||
| version: ${{ inputs.kubectl-version }} | ||||||
|
|
||||||
| - name: Install Helm | ||||||
| shell: bash | ||||||
| run: | | ||||||
| curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | ||||||
| chmod 700 get_helm.sh | ||||||
| DESIRED_VERSION=${{ inputs.helm-version }} bash get_helm.sh | ||||||
| helm version | ||||||
|
|
||||||
| - name: Install EKS CLI | ||||||
| if: inputs.eksctl-version != '' | ||||||
|
||||||
| if: inputs.eksctl-version != '' | |
| if: inputs.eksctl-version |
Copilot
AI
Nov 18, 2025
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.
The insecure flag --insecure is used when downloading eksctl. This disables certificate verification and could allow man-in-the-middle attacks. Remove the --insecure flag to ensure secure downloads.
Change:
curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/${{ inputs.eksctl-version }}/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp| curl --silent --insecure --location "https://github.com/weaveworks/eksctl/releases/download/${{ inputs.eksctl-version }}/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp | |
| curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/${{ inputs.eksctl-version }}/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,36 @@ | ||||||||||||||||
| name: 'Setup Operator Development Tools' | ||||||||||||||||
| description: 'Install Operator SDK, Ginkgo, and other operator development tools' | ||||||||||||||||
|
|
||||||||||||||||
| inputs: | ||||||||||||||||
| operator-sdk-version: | ||||||||||||||||
| description: 'Operator SDK version to install' | ||||||||||||||||
| required: true | ||||||||||||||||
| go-version: | ||||||||||||||||
| description: 'Go version for setup' | ||||||||||||||||
| required: true | ||||||||||||||||
|
|
||||||||||||||||
| runs: | ||||||||||||||||
| using: 'composite' | ||||||||||||||||
| steps: | ||||||||||||||||
| - name: Setup Go | ||||||||||||||||
| uses: actions/setup-go@v5 | ||||||||||||||||
| with: | ||||||||||||||||
| go-version: ${{ inputs.go-version }} | ||||||||||||||||
| cache: false | ||||||||||||||||
|
|
||||||||||||||||
| - name: Install Operator SDK | ||||||||||||||||
| shell: bash | ||||||||||||||||
| run: | | ||||||||||||||||
| export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac) | ||||||||||||||||
|
||||||||||||||||
| export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac) | |
| ARCH=$(uname -m) | |
| case "$ARCH" in | |
| x86_64) ARCH=amd64 ;; | |
| aarch64) ARCH=arm64 ;; | |
| esac | |
| export ARCH |
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.
The
make docker-buildxcommand is called with build-args concatenated directly. Ifinputs.build-argsis empty, this works fine, but if it contains special characters or spaces, it could cause issues. Consider using proper shell quoting or conditional inclusion.Example: