Skip to content
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

CI: Upgrade actions #1521

Merged
merged 3 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
id: label
shell: bash
run: echo "short_sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT

- name: Add commit short sha to Cargo.tomls version
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
run: |
Expand All @@ -34,7 +34,7 @@ runs:
run: cargo build --lib --release ${{ inputs.libraries-build-args }} ${{ inputs.common-build-args }}

- name: Publish Mithril Distribution (${{ runner.os }}-${{ runner.arch }})
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: mithril-distribution-${{ runner.os }}-${{ runner.arch }}
path: |
Expand Down
208 changes: 104 additions & 104 deletions .github/workflows/actions/deploy-terraform-infrastructure/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ inputs:
mithril_signers:
description: Mithril signers settings.
required: true
mithril_genesis_secret_key:
mithril_genesis_secret_key:
description: Mithril genesis secret key (only for test networks).
required: false
mithril_genesis_verification_key_url:
mithril_genesis_verification_key_url:
description: Mithril genesis verification key location.
required: true
mithril_era_reader_adapter_type:
description: Mithril era reader adapter type.
required: false
default: "cardano-chain"
mithril_era_reader_address_url:
mithril_era_reader_address_url:
description: Mithril era reader address location.
required: true
mithril_era_reader_verification_key_url:
mithril_era_reader_verification_key_url:
description: Mithril era reader verification key url.
required: true
mithril_era_reader_secret_key:
mithril_era_reader_secret_key:
description: Mithril era reader secret key (onlye for test networks).
required: false
mithril_aggregator_signed_entity_types:
Expand All @@ -88,143 +88,143 @@ inputs:
description: Mithril aggregator CNAME field used for the snapshot CDN.
required: false
default: "false"
mithril_aggregator_snapshot_compression_algorithm:
mithril_aggregator_snapshot_compression_algorithm:
description: Mithril aggregator snapshot compression algorithm.
required: false
mithril_aggregator_zstandard_parameters_level:
mithril_aggregator_zstandard_parameters_level:
description: Mithril aggregator snapshot zstandard compression level.
required: false
mithril_aggregator_zstandard_parameters_workers:
mithril_aggregator_zstandard_parameters_workers:
description: Mithril aggregator snapshot zstandard number of workers.
required: false
mithril_aggregator_cexplorer_pools_url:
description: CExplorer url of the list of pools that is used by the mithril aggregator.
required: false
prometheus_auth_username:
prometheus_auth_username:
description: Prometheus metrics endpoint username.
required: false
prometheus_auth_password:
prometheus_auth_password:
description: Prometheus metrics endpoint password.
required: false
prometheus_ingest_host:
prometheus_ingest_host:
description: Prometheus ingester endpoint location.
required: false
prometheus_ingest_username:
prometheus_ingest_username:
description: Prometheus ingester endpoint username.
required: false
prometheus_ingest_password:
prometheus_ingest_password:
description: Prometheus ingester endpoint password.
required: false
loki_auth_username:
loki_auth_username:
description: Loki metrics endpoint username.
required: false
loki_auth_password:
loki_auth_password:
description: Loki metrics endpoint password.
required: false
loki_ingest_host:
loki_ingest_host:
description: Loki ingester endpoint location.
required: false
loki_ingest_username:
loki_ingest_username:
description: Loki ingester endpoint username.
required: false
loki_ingest_password:
loki_ingest_password:
description: Loki ingester endpoint password.
required: false

runs:
using: "composite"
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Checkout sources
uses: actions/checkout@v4

- name: Prepare service account credentials
shell: bash
working-directory: mithril-infra
run: |
echo '${{ inputs.google_application_credentials}}' > ./google-application-credentials.json
chmod u+x ./assets/tools/utils/google-credentials-public-key.sh
./assets/tools/utils/google-credentials-public-key.sh ./google-application-credentials.json ./assets/ssh_keys curry
- name: Prepare service account credentials
shell: bash
working-directory: mithril-infra
run: |
echo '${{ inputs.google_application_credentials}}' > ./google-application-credentials.json
chmod u+x ./assets/tools/utils/google-credentials-public-key.sh
./assets/tools/utils/google-credentials-public-key.sh ./google-application-credentials.json ./assets/ssh_keys curry

- name: Prepare terraform variables
shell: bash
working-directory: mithril-infra
run: |
cat > ./env.variables.tfvars << EOF
environment_prefix = "${{ inputs.environment_prefix }}"
cardano_network = "${{ inputs.cardano_network }}"
cardano_image_id = "${{ inputs.cardano_node_version }}"
cardano_image_registry = "${{ inputs.cardano_node_docker_registry }}"
google_region = "${{ inputs.google_region }}"
google_zone = "${{ inputs.google_zone }}"
google_machine_type = "${{ inputs.google_machine_type }}"
google_compute_instance_boot_disk_size = "${{ inputs.google_compute_instance_boot_disk_size }}"
google_compute_instance_data_disk_size = "${{ inputs.google_compute_instance_data_disk_size }}"
google_service_credentials_json_file = "./google-application-credentials.json"
mithril_use_p2p_network = "${{ inputs.mithril_use_p2p_network }}"
mithril_api_domain = "${{ inputs.mithril_api_domain }}"
mithril_image_id = "${{ inputs.mithril_image_id }}"
mithril_genesis_verification_key_url = "${{ inputs.mithril_genesis_verification_key_url }}"
mithril_genesis_secret_key = "${{ inputs.mithril_genesis_secret_key }}"
mithril_protocol_parameters = ${{ fromJSON(inputs.mithril_protocol_parameters) }}
mithril_signers = ${{ fromJSON(inputs.mithril_signers) }}
mithril_era_reader_adapter_type = "${{ inputs.mithril_era_reader_adapter_type }}"
mithril_era_reader_address_url = "${{ inputs.mithril_era_reader_address_url }}"
mithril_era_reader_verification_key_url = "${{ inputs.mithril_era_reader_verification_key_url }}"
mithril_era_reader_secret_key = "${{ inputs.mithril_era_reader_secret_key }}"
mithril_aggregator_signed_entity_types = "${{ inputs.mithril_aggregator_signed_entity_types }}"
mithril_aggregator_cdn_cname = "${{ inputs.mithril_aggregator_cdn_cname }}"
mithril_aggregator_snapshot_use_cdn_domain = ${{ inputs.mithril_aggregator_snapshot_use_cdn_domain }}
mithril_aggregator_snapshot_compression_algorithm = "${{ inputs.mithril_aggregator_snapshot_compression_algorithm }}"
mithril_aggregator_zstandard_parameters_level = "${{ inputs.mithril_aggregator_zstandard_parameters_level }}"
mithril_aggregator_zstandard_parameters_workers = "${{ inputs.mithril_aggregator_zstandard_parameters_workers }}"
mithril_aggregator_cexplorer_pools_url = "${{ inputs.mithril_aggregator_cexplorer_pools_url }}"
prometheus_auth_username = "${{ inputs.prometheus_auth_username }}"
prometheus_auth_password = "${{ inputs.prometheus_auth_password }}"
prometheus_ingest_host = "${{ inputs.prometheus_ingest_host }}"
prometheus_ingest_username = "${{ inputs.prometheus_ingest_username }}"
prometheus_ingest_password = "${{ inputs.prometheus_ingest_password }}"
loki_auth_username = "${{ inputs.loki_auth_username }}"
loki_auth_password = "${{ inputs.loki_auth_password }}"
loki_ingest_host = "${{ inputs.loki_ingest_host }}"
loki_ingest_username = "${{ inputs.loki_ingest_username }}"
loki_ingest_password = "${{ inputs.loki_ingest_password }}"
EOF
terraform fmt ./env.variables.tfvars
cat ./env.variables.tfvars
- name: Prepare terraform variables
shell: bash
working-directory: mithril-infra
run: |
cat > ./env.variables.tfvars << EOF
environment_prefix = "${{ inputs.environment_prefix }}"
cardano_network = "${{ inputs.cardano_network }}"
cardano_image_id = "${{ inputs.cardano_node_version }}"
cardano_image_registry = "${{ inputs.cardano_node_docker_registry }}"
google_region = "${{ inputs.google_region }}"
google_zone = "${{ inputs.google_zone }}"
google_machine_type = "${{ inputs.google_machine_type }}"
google_compute_instance_boot_disk_size = "${{ inputs.google_compute_instance_boot_disk_size }}"
google_compute_instance_data_disk_size = "${{ inputs.google_compute_instance_data_disk_size }}"
google_service_credentials_json_file = "./google-application-credentials.json"
mithril_use_p2p_network = "${{ inputs.mithril_use_p2p_network }}"
mithril_api_domain = "${{ inputs.mithril_api_domain }}"
mithril_image_id = "${{ inputs.mithril_image_id }}"
mithril_genesis_verification_key_url = "${{ inputs.mithril_genesis_verification_key_url }}"
mithril_genesis_secret_key = "${{ inputs.mithril_genesis_secret_key }}"
mithril_protocol_parameters = ${{ fromJSON(inputs.mithril_protocol_parameters) }}
mithril_signers = ${{ fromJSON(inputs.mithril_signers) }}
mithril_era_reader_adapter_type = "${{ inputs.mithril_era_reader_adapter_type }}"
mithril_era_reader_address_url = "${{ inputs.mithril_era_reader_address_url }}"
mithril_era_reader_verification_key_url = "${{ inputs.mithril_era_reader_verification_key_url }}"
mithril_era_reader_secret_key = "${{ inputs.mithril_era_reader_secret_key }}"
mithril_aggregator_signed_entity_types = "${{ inputs.mithril_aggregator_signed_entity_types }}"
mithril_aggregator_cdn_cname = "${{ inputs.mithril_aggregator_cdn_cname }}"
mithril_aggregator_snapshot_use_cdn_domain = ${{ inputs.mithril_aggregator_snapshot_use_cdn_domain }}
mithril_aggregator_snapshot_compression_algorithm = "${{ inputs.mithril_aggregator_snapshot_compression_algorithm }}"
mithril_aggregator_zstandard_parameters_level = "${{ inputs.mithril_aggregator_zstandard_parameters_level }}"
mithril_aggregator_zstandard_parameters_workers = "${{ inputs.mithril_aggregator_zstandard_parameters_workers }}"
mithril_aggregator_cexplorer_pools_url = "${{ inputs.mithril_aggregator_cexplorer_pools_url }}"
prometheus_auth_username = "${{ inputs.prometheus_auth_username }}"
prometheus_auth_password = "${{ inputs.prometheus_auth_password }}"
prometheus_ingest_host = "${{ inputs.prometheus_ingest_host }}"
prometheus_ingest_username = "${{ inputs.prometheus_ingest_username }}"
prometheus_ingest_password = "${{ inputs.prometheus_ingest_password }}"
loki_auth_username = "${{ inputs.loki_auth_username }}"
loki_auth_password = "${{ inputs.loki_auth_password }}"
loki_ingest_host = "${{ inputs.loki_ingest_host }}"
loki_ingest_username = "${{ inputs.loki_ingest_username }}"
loki_ingest_password = "${{ inputs.loki_ingest_password }}"
EOF
terraform fmt ./env.variables.tfvars
cat ./env.variables.tfvars

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: false

- name: Init Terraform
shell: bash
working-directory: mithril-infra
run: |
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform init -backend-config="bucket=${{ inputs.terraform_backend_bucket }}" -backend-config="prefix=terraform/mithril-${{ inputs.environment }}" -upgrade
- name: Init Terraform
shell: bash
working-directory: mithril-infra
run: |
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform init -backend-config="bucket=${{ inputs.terraform_backend_bucket }}" -backend-config="prefix=terraform/mithril-${{ inputs.environment }}" -upgrade

- name: Check Terraform
shell: bash
working-directory: mithril-infra
run: terraform fmt -check
- name: Check Terraform
shell: bash
working-directory: mithril-infra
run: terraform fmt -check

- name: Terraform Plan
if: inputs.dry_run == 'true'
shell: bash
working-directory: mithril-infra
run: |
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform plan --var-file=./env.variables.tfvars
- name: Terraform Plan
if: inputs.dry_run == 'true'
shell: bash
working-directory: mithril-infra
run: |
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform plan --var-file=./env.variables.tfvars

- name: Terraform Apply
shell: bash
working-directory: mithril-infra
if: inputs.dry_run == 'false'
run: |
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform apply -auto-approve --var-file=./env.variables.tfvars
- name: Terraform Apply
shell: bash
working-directory: mithril-infra
if: inputs.dry_run == 'false'
run: |
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform apply -auto-approve --var-file=./env.variables.tfvars

- name: Cleanup
shell: bash
working-directory: mithril-infra
run: |
rm -f ./env.variables.tfvars
rm -f ./google-application-credentials.json
- name: Cleanup
shell: bash
working-directory: mithril-infra
run: |
rm -f ./env.variables.tfvars
rm -f ./google-application-credentials.json
Loading
Loading