fix label of volumeClaimTemplates for MC #374
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: Pull Request | |
on: | |
pull_request: | |
branches: | |
- 4.2.z | |
paths-ignore: | |
- '**.md' | |
pull_request_target: | |
types: [labeled] | |
branches: | |
- 4.2.z | |
paths-ignore: | |
- '**.md' | |
permissions: | |
contents: read | |
jobs: | |
tests: | |
if: >- | |
(github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name,'safe-to-test') && github.event.pull_request.head.repo.full_name != github.repository) || | |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) | |
name: Run tests | |
runs-on: ubuntu-20.04 | |
env: | |
KUBECTL_VERSION: 1.22.0 | |
GCP_PROJECT_ID: hazelcast-33 | |
GCP_NETWORK: operator-test-network | |
GKE_ZONE: europe-west1-b | |
steps: | |
- name: Decide which ref to checkout | |
id: decide-ref | |
run: | | |
if [[ "${{github.event_name}}" == "pull_request" ]]; then | |
echo "::set-output name=ref::${{github.ref}}" | |
else | |
echo "::set-output name=ref::refs/pull/${{ github.event.pull_request.number }}/merge" | |
fi | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{steps.decide-ref.outputs.ref}} | |
fetch-depth: 0 | |
- name: Add remote hazelcast | |
run: | | |
git remote add hazelcast https://github.com/hazelcast/charts.git | |
git fetch hazelcast 4.2.z | |
- name: Set up Cloud SDK | |
uses: google-github-actions/[email protected] | |
with: | |
project_id: ${{ env.GCP_PROJECT_ID }} | |
- name: Authenticate to GCP | |
uses: 'google-github-actions/[email protected]' | |
with: | |
credentials_json: ${{ secrets.GKE_SA_KEY }} | |
- name: Set up Helm | |
uses: azure/[email protected] | |
with: | |
version: v3.10.3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: Set up chart-testing | |
uses: helm/[email protected] | |
- name: Add values.yaml for testing | |
run: | | |
MODIFIED_CHARTS=( $(ct list-changed --config ${GITHUB_WORKSPACE}/test/ct.yaml ) ) | |
for chart in "${MODIFIED_CHARTS[@]}" | |
do | |
if [ $chart == "stable/hazelcast" ]; then | |
mkdir -p ${GITHUB_WORKSPACE}/stable/hazelcast/ci | |
cat << EOF > ${GITHUB_WORKSPACE}/stable/hazelcast/ci/gha_gke-values.yaml | |
mancenter: | |
licenseKey: ${{ secrets.HZ_LICENSE_KEY }} | |
devMode: | |
enabled: true | |
javaOpts: "-Dhazelcast.mc.rest.enabled=true" | |
EOF | |
fi | |
if [ $chart == "stable/hazelcast-enterprise" ]; then | |
mkdir -p ${GITHUB_WORKSPACE}/stable/hazelcast-enterprise/ci | |
cat << EOF > ${GITHUB_WORKSPACE}/stable/hazelcast-enterprise/ci/gha_gke-values.yaml | |
hazelcast: | |
licenseKey: ${{ secrets.HZ_LICENSE_KEY }} | |
mancenter: | |
devMode: | |
enabled: true | |
javaOpts: "-Dhazelcast.mc.rest.enabled=true" | |
EOF | |
fi | |
done | |
- name: Lint Charts | |
run: | | |
ct lint --config ${GITHUB_WORKSPACE}/test/ct.yaml | |
- name: Create GKE cluster | |
run: |- | |
CLUSTER_NAME="charts-pr-test-${GITHUB_SHA::8}-${GITHUB_RUN_NUMBER}" | |
echo "CLUSTER_NAME=${CLUSTER_NAME}" >> $GITHUB_ENV | |
gcloud container clusters create ${CLUSTER_NAME} --zone=${{ env.GKE_ZONE }} --project=${{ env.GCP_PROJECT_ID }} --network=${{ env.GCP_NETWORK }} --machine-type=n1-standard-2 --num-nodes=2 | |
sleep 30 | |
- name: Connect to the GKE cluster | |
uses: 'google-github-actions/get-gke-credentials@v1' | |
with: | |
cluster_name: ${{ env.CLUSTER_NAME }} | |
project_id: ${{ env.GCP_PROJECT_ID }} | |
location: ${{ env.GKE_ZONE }} | |
- name: Test Charts | |
run: | | |
ct install --config ${GITHUB_WORKSPACE}/test/ct.yaml | |
- name: Delete GKE cluster | |
if: always() | |
run: |- | |
gcloud container clusters delete ${{ env.CLUSTER_NAME }} --zone ${{ env.GKE_ZONE }} --quiet |