Skip to content

Commit 2c1c797

Browse files
committed
change other workflow to run
1 parent 0b66014 commit 2c1c797

1 file changed

Lines changed: 73 additions & 86 deletions

File tree

.github/workflows/integration-test.yml

Lines changed: 73 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -85,62 +85,61 @@ jobs:
8585
outputs:
8686
should_continue: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'schedule') }}
8787

88-
# # Get latest operator commit from github repo
89-
# GetLatestOperatorCommitSHA:
90-
# needs: check-trigger
91-
# if: ${{ needs.check-trigger.outputs.should_continue == 'true' }}
92-
# runs-on: ubuntu-latest
93-
# outputs:
94-
# operator_commit_sha: ${{steps.get_latest_sha.outputs.operator_sha}}
95-
# operator_repo_name: ${{env.OPERATOR_GITHUB_REPO_NAME}}
96-
# steps:
97-
# - name: Checkout the target repo
98-
# uses: actions/checkout@v4
99-
# with:
100-
# repository: ${{env.OPERATOR_GITHUB_REPO_NAME}}
101-
# ref: ${{ inputs.operator-branch || 'main' }}
102-
# path: operator-repo
103-
#
104-
# - name: Get latest commit SHA
105-
# id: get_latest_sha
106-
# run: |
107-
# cd operator-repo
108-
# latest_sha=$(git rev-parse HEAD)
109-
# echo "operator_sha=$latest_sha" >> "$GITHUB_OUTPUT"
110-
#
111-
# # Build and upload agent image to ECR repo
112-
# BuildAgent:
113-
# needs: check-trigger
114-
# if: ${{ needs.check-trigger.outputs.should_continue == 'true' }}
115-
# uses: ./.github/workflows/build-test-artifacts.yml
116-
# concurrency:
117-
# group: "Build-Test-Artifacts-${{github.ref_name}}"
118-
# cancel-in-progress: true
119-
# secrets: inherit
120-
# permissions:
121-
# id-token: write
122-
# contents: read
123-
# with:
124-
# test-image-before-upload: false
125-
#
126-
# # Build and upload operator image to ECR repo
127-
# BuildOperator:
128-
# needs: [ check-trigger, GetLatestOperatorCommitSHA ]
129-
# if: ${{ needs.check-trigger.outputs.should_continue == 'true' }}
130-
# uses: aws/amazon-cloudwatch-agent-operator/.github/workflows/build-and-upload.yml@main
131-
# concurrency:
132-
# group: ${{ github.workflow }}-operator-${{ inputs.operator-branch || 'main' }}
133-
# cancel-in-progress: true
134-
# secrets: inherit
135-
# with:
136-
# tag: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha}}
137-
# target-sha: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha}}
138-
# repository: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_repo_name}}
139-
# test-image-before-upload: false
88+
# Get latest operator commit from github repo
89+
GetLatestOperatorCommitSHA:
90+
needs: check-trigger
91+
if: ${{ needs.check-trigger.outputs.should_continue == 'true' }}
92+
runs-on: ubuntu-latest
93+
outputs:
94+
operator_commit_sha: ${{steps.get_latest_sha.outputs.operator_sha}}
95+
operator_repo_name: ${{env.OPERATOR_GITHUB_REPO_NAME}}
96+
steps:
97+
- name: Checkout the target repo
98+
uses: actions/checkout@v4
99+
with:
100+
repository: ${{env.OPERATOR_GITHUB_REPO_NAME}}
101+
ref: ${{ inputs.operator-branch || 'main' }}
102+
path: operator-repo
103+
104+
- name: Get latest commit SHA
105+
id: get_latest_sha
106+
run: |
107+
cd operator-repo
108+
latest_sha=$(git rev-parse HEAD)
109+
echo "operator_sha=$latest_sha" >> "$GITHUB_OUTPUT"
110+
111+
# Build and upload agent image to ECR repo
112+
BuildAgent:
113+
needs: check-trigger
114+
if: ${{ needs.check-trigger.outputs.should_continue == 'true' }}
115+
uses: ./.github/workflows/build-test-artifacts.yml
116+
concurrency:
117+
group: "Build-Test-Artifacts-${{github.ref_name}}"
118+
cancel-in-progress: true
119+
secrets: inherit
120+
permissions:
121+
id-token: write
122+
contents: read
123+
with:
124+
test-image-before-upload: false
125+
126+
# Build and upload operator image to ECR repo
127+
BuildOperator:
128+
needs: [ check-trigger, GetLatestOperatorCommitSHA ]
129+
if: ${{ needs.check-trigger.outputs.should_continue == 'true' }}
130+
uses: aws/amazon-cloudwatch-agent-operator/.github/workflows/build-and-upload.yml@main
131+
concurrency:
132+
group: ${{ github.workflow }}-operator-${{ inputs.operator-branch || 'main' }}
133+
cancel-in-progress: true
134+
secrets: inherit
135+
with:
136+
tag: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha}}
137+
target-sha: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha}}
138+
repository: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_repo_name}}
139+
test-image-before-upload: false
140140

141141
install-helm:
142-
needs: [ check-trigger ]
143-
# needs: [ check-trigger, BuildAgent, BuildOperator ]
142+
needs: [ check-trigger, BuildAgent, BuildOperator ]
144143
if: ${{ needs.check-trigger.outputs.should_continue == 'true' }}
145144
runs-on: ubuntu-latest
146145
permissions:
@@ -179,38 +178,26 @@ jobs:
179178
180179
- name: Check node count and manage Helm chart
181180
run: |
182-
NODE_COUNT=$(kubectl get nodes --no-headers | wc -l)
183-
184-
if [ "$NODE_COUNT" -eq 0 ]; then
185-
echo "Node count is 0, removing Helm chart"
186-
helm uninstall amazon-cloudwatch-observability -n amazon-cloudwatch || echo "Chart not found or already removed"
187-
else
188-
echo "Node count is $NODE_COUNT, installing/updating Helm chart"
189-
helm template amazon-cloudwatch-observability \
190-
./helm-charts/charts/amazon-cloudwatch-observability \
191-
--namespace amazon-cloudwatch \
192-
--create-namespace \
193-
--set clusterName="eks-performance" \
194-
--set region="us-west-2" \
195-
--set agent.image.repository="cloudwatch-agent" \
196-
--set agent.image.tag="latest" \
197-
--set agent.image.repositoryDomainMap.public="public.ecr.aws/cloudwatch-agent" \
198-
--set manager.image.repository="cloudwatch-agent-operator" \
199-
--set manager.image.tag="latest" \
200-
--set manager.image.repositoryDomainMap.public="public.ecr.aws/cloudwatch-agent"
201-
# helm upgrade --install amazon-cloudwatch-observability \
202-
# ./helm-charts/charts/amazon-cloudwatch-observability \
203-
# --namespace amazon-cloudwatch \
204-
# --create-namespace \
205-
# --set clusterName=${{ inputs.cluster_name ||env.CLUSTER_NAME }} \
206-
# --set region=${{ inputs.region || env.AWS_REGION }} \
207-
# --set agent.image.repository=${{ inputs.cloudwatch_agent_repository || env.AGENT_ECR_TEST_REPO }} \
208-
# --set agent.image.tag=${{ inputs.cloudwatch_agent_tag || github.sha }} \
209-
# --set agent.image.repositoryDomainMap.public=${{ steps.login-ecr.outputs.registry }} \
210-
# --set manager.image.repository=${{ inputs.cloudwatch_agent_operator_repository || env.OPERATOR_ECR_TEST_REPO }} \
211-
# --set manager.image.tag=${{ inputs.cloudwatch_agent_operator_tag || needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha }} \
212-
# --set manager.image.repositoryDomainMap.public=${{ steps.login-ecr.outputs.registry }}
213-
fi
181+
NODE_COUNT=$(kubectl get nodes --no-headers | wc -l)
182+
183+
if [ "$NODE_COUNT" -eq 0 ]; then
184+
echo "Node count is 0, removing Helm chart"
185+
helm uninstall amazon-cloudwatch-observability -n amazon-cloudwatch || echo "Chart not found or already removed"
186+
else
187+
echo "Node count is $NODE_COUNT, installing/updating Helm chart"
188+
helm upgrade --install amazon-cloudwatch-observability \
189+
./helm-charts/charts/amazon-cloudwatch-observability \
190+
--namespace amazon-cloudwatch \
191+
--create-namespace \
192+
--set clusterName=${{ inputs.cluster_name ||env.CLUSTER_NAME }} \
193+
--set region=${{ inputs.region || env.AWS_REGION }} \
194+
--set agent.image.repository=${{ inputs.cloudwatch_agent_repository || env.AGENT_ECR_TEST_REPO }} \
195+
--set agent.image.tag=${{ inputs.cloudwatch_agent_tag || github.sha }} \
196+
--set agent.image.repositoryDomainMap.public=${{ steps.login-ecr.outputs.registry }} \
197+
--set manager.image.repository=${{ inputs.cloudwatch_agent_operator_repository || env.OPERATOR_ECR_TEST_REPO }} \
198+
--set manager.image.tag=${{ inputs.cloudwatch_agent_operator_tag || needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha }} \
199+
--set manager.image.repositoryDomainMap.public=${{ steps.login-ecr.outputs.registry }}
200+
fi
214201
215202
cleanup-on-failure:
216203
if: ${{ failure() || cancelled() }}

0 commit comments

Comments
 (0)