Test Jfrog Kubelet Plugin #21
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
| name: Test Jfrog Kubelet Plugin | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| JFROG_CREDENTIAL_PLUGIN_BINARY_URL: | |
| description: 'BINARY_URL (CI adds arch suffix automatically)' | |
| required: true | |
| default: "https://releases.jfrog.io/artifactory/run/jfrog-credentials-provider/0.1.0-beta.1/jfrog-credential-provider-aws-linux" | |
| type: string | |
| DISABLE_TERRAFORM_DESTROY: | |
| description: 'DISABLE_TERRAFORM_DESTROY' | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| AWS_REGION: ap-northeast-3 | |
| TF_VERSION: 1.5.7 | |
| jobs: | |
| verify-kubelet-plugin: | |
| runs-on: self-hosted | |
| env: | |
| ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} | |
| JFROG_CREDENTIAL_PLUGIN_BINARY_URL: ${{ github.event.inputs.JFROG_CREDENTIAL_PLUGIN_BINARY_URL }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Configure aws credentials | |
| uses: aws-actions/configure-aws-credentials@v4.1.0 | |
| with: | |
| role-to-assume: arn:aws:iam::095132750011:role/github-actions-kubelet-ci-role | |
| role-session-name: kubelettestcisession | |
| aws-region: ap-northeast-3 | |
| - name: Verify if aws is connected | |
| run: | | |
| aws sts get-caller-identity | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: ${{ env.TF_VERSION }} | |
| terraform_wrapper: false | |
| - name: Initialise Terraform | |
| id: init | |
| run: | | |
| echo "" >> build/terraform.tfvars | |
| echo "jfrog_credential_provider_binary_url=\"$JFROG_CREDENTIAL_PLUGIN_BINARY_URL\"" >> build/terraform.tfvars | |
| cp build/terraform.tfvars terraform-ci/terraform.tfvars | |
| cd terraform-ci | |
| terraform init | |
| - name: Run Terraform CI | |
| id: apply | |
| run: | | |
| cd terraform-ci | |
| terraform apply -input=false -auto-approve | |
| terraform output -json > terraform_output.json | |
| echo "Terraform output: $(cat terraform_output.json)" | |
| - name: Destroy terraform resources | |
| id: destroy | |
| if: always() && !env.DISABLE_TERRAFORM_DESTROY | |
| continue-on-error: true | |
| run: | | |
| cd terraform-ci | |
| terraform destroy -input=false -auto-approve | |
| rm terraform.tfstate terraform.tfstate.backup terraform_output.json | |
| - name: Upload Terraform context for manual cleanup | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: terraform-context-for-manual-cleanup | |
| path: | | |
| terraform-ci/**/*.tf | |
| terraform-ci/jfrog/* | |
| terraform-ci/terraform.tfstate | |
| terraform-ci/terraform.tfstate.backup | |
| terraform-ci/terraform.tfvars | |
| terraform-ci/.terraform.lock.hcl | |
| terraform-ci/terraform_output.json | |
| retention-days: 1 |