Skip to content

Commit

Permalink
Try outputing rendered template
Browse files Browse the repository at this point in the history
  • Loading branch information
frankinspace committed Mar 21, 2024
1 parent fd79394 commit 156d21c
Show file tree
Hide file tree
Showing 8 changed files with 970 additions and 913 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/cicd-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ jobs:
pyproject_name: ${{ steps.poetry-build.outputs.pyproject_name }}
tf_module_artifact_name: ${{ steps.poetry-build.outputs.tf_module_artifact_name }}
steps:
- uses: getsentry/action-github-app-token@v2.0.0
- uses: getsentry/action-github-app-token@v3
name: CICD Token
id: cicd-app
with:
app_id: ${{ secrets.CICD_APP_ID }}
private_key: ${{ secrets.CICD_APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
token: ${{ steps.cicd-app.outputs.token }}
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Get version
Expand Down Expand Up @@ -107,8 +107,14 @@ jobs:
poetry version major
echo "software_version=$(poetry version | awk '{print $2}')" >> $GITHUB_ENV
echo "TARGET_ENV_UPPERCASE=OPS" >> $GITHUB_ENV
- name: No version bump
# If triggered by workflow dispatch, no version bump
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "software_version=$(poetry version | awk '{print $2}')" >> $GITHUB_ENV
echo "TARGET_ENV_UPPERCASE=${{ github.event.inputs.venue }}" >> $GITHUB_ENV
- name: Install conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: bignbit
environment-file: conda-environment.yaml
Expand Down Expand Up @@ -162,7 +168,7 @@ jobs:
run: mv terraform ${{ steps.poetry-build.outputs.tf_module_artifact_name }}
- name: Zip artifact for deployment
run: zip ${{ steps.poetry-build.outputs.tf_module_artifact_name }}.zip ${{ steps.poetry-build.outputs.tf_module_artifact_name }}/* -r
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.poetry-build.outputs.tf_module_artifact_name }}
path: ${{ steps.poetry-build.outputs.tf_module_artifact_name }}.zip
Expand Down Expand Up @@ -211,7 +217,7 @@ jobs:
THE_VERSION: ${{ needs.build.outputs.version }}
PYPROJECT_NAME: ${{ needs.build.outputs.pyproject_name }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
- name: Log in to the Container registry
Expand All @@ -222,13 +228,13 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{env.PYPROJECT_NAME}}
tags: |
type=pep440,pattern={{version}},value=${{ env.THE_VERSION }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
Expand All @@ -244,7 +250,7 @@ jobs:
name: Deploy
needs: [build, docker]
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.venue || needs.build.outputs.deploy_env }}
environment: needs.build.outputs.deploy_env
env:
THE_VERSION: ${{ needs.build.outputs.version }}
CONTAINER_IMAGE_URI: ${{ needs.docker.outputs.container_image_uri }}
Expand All @@ -255,10 +261,10 @@ jobs:
startsWith(github.ref, 'refs/heads/release') ||
github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
- uses: hashicorp/setup-terraform@v2
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false
Expand Down
19 changes: 19 additions & 0 deletions examples/cumulus-tf/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 1 addition & 19 deletions examples/cumulus-tf/browse_image_workflow.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@ module "browse_image_workflow" {
system_bucket = var.system_bucket
tags = merge(local.tags, { application = "BrowseImageWorkflow" })
state_machine_definition = templatefile("../../terraform/state_machine_definition.json", {
GetDatasetConfigurationLambda = module.bignbit_module.get_dataset_configuration_arn,
ConfigBucket = module.bignbit_module.config_bucket_name,
ConfigDir = module.bignbit_module.config_path,
GetGranuleUmmJsonLambda = module.bignbit_module.get_granule_umm_json_arn,
IdentifyImageFileLambda = module.bignbit_module.identify_image_file_arn,
ApplyOperaTreatmentLambda = module.bignbit_module.apply_opera_treatment_arn,
GetCollectionConceptIdLambda = module.bignbit_module.get_collection_concept_id_arn,
SubmitHarmonyJobLambda = module.bignbit_module.submit_harmony_job_arn,
GetHarmonyJobStatusLambda = module.bignbit_module.get_harmony_job_status_arn,
CopyHarmonyOutputToS3Lambda = module.bignbit_module.copy_harmony_output_to_s3_arn,
GenerateImageMetadataLambda = module.bignbit_module.generate_image_metadata_arn,
BuildImageSetsLambda = module.bignbit_module.pobit_build_image_sets_arn,
SendToGITCLambda = module.bignbit_module.pobit_send_to_gitc_arn,
SaveCMAMessageLambda = module.bignbit_module.pobit_save_cma_message_arn,
PobitAuditBucket = module.bignbit_module.pobit_audit_bucket,
PobitAuditPath = module.bignbit_module.pobit_audit_path
}
)
state_machine_definition = module.bignbit_module.workflow_definition
}
*/
20 changes: 1 addition & 19 deletions examples/cumulus-tf/step.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,5 @@ resource "aws_sfn_state_machine" "sfn_state_machine" {
name = "${local.ec2_resources_name}-BrowseImageWorkflow"
role_arn = aws_iam_role.step.arn

definition = templatefile("../../terraform/state_machine_definition.json", {
GetDatasetConfigurationLambda = module.bignbit_module.get_dataset_configuration_arn,
ConfigBucket = module.bignbit_module.config_bucket_name,
ConfigDir = module.bignbit_module.config_path,
GetGranuleUmmJsonLambda = module.bignbit_module.get_granule_umm_json_arn,
IdentifyImageFileLambda = module.bignbit_module.identify_image_file_arn,
ApplyOperaTreatmentLambda = module.bignbit_module.apply_opera_treatment_arn,
GetCollectionConceptIdLambda = module.bignbit_module.get_collection_concept_id_arn,
SubmitHarmonyJobLambda = module.bignbit_module.submit_harmony_job_arn,
GetHarmonyJobStatusLambda = module.bignbit_module.get_harmony_job_status_arn,
CopyHarmonyOutputToS3Lambda = module.bignbit_module.copy_harmony_output_to_s3_arn,
GenerateImageMetadataLambda = module.bignbit_module.generate_image_metadata_arn,
BuildImageSetsLambda = module.bignbit_module.pobit_build_image_sets_arn,
SendToGITCLambda = module.bignbit_module.pobit_send_to_gitc_arn,
SaveCMAMessageLambda = module.bignbit_module.pobit_save_cma_message_arn,
PobitAuditBucket = module.bignbit_module.pobit_audit_bucket,
PobitAuditPath = module.bignbit_module.pobit_audit_path
}
)
definition = module.bignbit_module.workflow_definition
}
Loading

0 comments on commit 156d21c

Please sign in to comment.