Skip to content

Commit

Permalink
update: move CIRRUS versions to outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
mckadesorensen committed Dec 22, 2023
1 parent 48ba6b6 commit 0b417bd
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 37 deletions.
13 changes: 4 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ export TF_VAR_MATURITY=${MATURITY}
export TF_VAR_DEPLOY_NAME=${DEPLOY_NAME}
PYTHON_VER ?= python3


CIRRUS_DAAC_BRANCH := $(shell git -C $(DAAC_DIR) rev-parse --abbrev-ref HEAD)
CIRRUS_CORE_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
CIRRUS_DAAC_TAG := $(shell git -C $(DAAC_DIR) describe --tags --abbrev=0)
CIRRUS_CORE_TAG := $(shell git describe --tags --abbrev=0)
CIRRUS_CORE_VERSION := $(or $(shell git tag --points-at HEAD | head -n1),$(shell git rev-parse --short HEAD))
CIRRUS_DAAC_VERSION := $(or $(shell git -C $(DAAC_DIR) tag --points-at HEAD | head -n1),$(shell git -C $(DAAC_DIR) rev-parse --short HEAD))

# ---------------------------
SELF_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
Expand Down Expand Up @@ -65,10 +62,8 @@ container-shell:
--env AWS_CONFIG_DIR="/" \
--env PS1='\s-\v:\w\$$ ' \
--env HISTFILE="/CIRRUS-core/.container_bash_history" \
--env TF_VAR_CIRRUS_CORE_BRANCH=${CIRRUS_CORE_BRANCH} \
--env TF_VAR_CIRRUS_DAAC_BRANCH=${CIRRUS_DAAC_BRANCH} \
--env TF_VAR_CIRRUS_CORE_TAG=${CIRRUS_CORE_TAG} \
--env TF_VAR_CIRRUS_DAAC_TAG=${CIRRUS_DAAC_TAG} \
--env TF_VAR_CIRRUS_CORE_VERSION=${CIRRUS_CORE_VERSION} \
--env TF_VAR_CIRRUS_DAAC_VERSION=${CIRRUS_DAAC_VERSION} \
-v ${PWD}:/CIRRUS-core \
-v ${DAAC_DIR}:/CIRRUS-DAAC \
-v ${HOME}/.aws:/.aws \
Expand Down
8 changes: 8 additions & 0 deletions cumulus/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,11 @@ output "background_job_queue_url" {
output "vpc" {
value = data.aws_vpc.application_vpcs.id
}

output "cirrus_core_version" {
value = var.CIRRUS_CORE_VERSION
}

output "cirrus_daac_version" {
value = var.CIRRUS_DAAC_VERSION
}
8 changes: 8 additions & 0 deletions cumulus/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ variable "MATURITY" {
default = "dev"
}

variable "CIRRUS_CORE_VERSION" {
type = string
}

variable "CIRRUS_DAAC_VERSION" {
type = string
}

variable "cmr_environment" {
type = string
}
Expand Down
8 changes: 8 additions & 0 deletions data-persistence/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@ output "rds_security_group_id" {
output "rds_user_access_secret_arn" {
value = data.terraform_remote_state.rds.outputs.rds_user_access_secret_arn
}

output "cirrus_core_version" {
value = var.CIRRUS_CORE_VERSION
}

output "cirrus_daac_version" {
value = var.CIRRUS_DAAC_VERSION
}
8 changes: 8 additions & 0 deletions data-persistence/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ variable "MATURITY" {
default = "dev"
}

variable "CIRRUS_CORE_VERSION" {
type = string
}

variable "CIRRUS_DAAC_VERSION" {
type = string
}

variable "include_elasticsearch" {
type = bool
default = true
Expand Down
3 changes: 0 additions & 3 deletions tf/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ locals {
aws_account_id = data.aws_caller_identity.current.account_id
aws_account_id_last4 = substr(data.aws_caller_identity.current.account_id, -4, 4)

cirrus_core_version = var.CIRRUS_CORE_BRANCH == "HEAD" ? var.CIRRUS_CORE_TAG: var.CIRRUS_CORE_BRANCH
cirrus_daac_version = var.CIRRUS_DAAC_BRANCH == "HEAD" ? var.CIRRUS_DAAC_TAG: var.CIRRUS_DAAC_BRANCH

default_tags = {
Deployment = local.prefix
}
Expand Down
15 changes: 0 additions & 15 deletions tf/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,3 @@ resource "aws_dynamodb_table" "backend-tf-locks-table" {
}
tags = local.default_tags
}

resource "aws_s3_object" "cirrus-versions" {
bucket = aws_s3_bucket.backend-tf-state-bucket.id
key = "cirrus-versions.json"
content_type = "application/json"

content = <<JSON
{
"CIRRUS-core-version": "${local.cirrus_core_version}",
"CIRRUS-DAAC-version": "${local.cirrus_daac_version}",
}
JSON

tags = local.default_tags
}
7 changes: 7 additions & 0 deletions tf/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
output "cirrus_core_version" {
value = var.CIRRUS_CORE_VERSION
}

output "cirrus_daac_version" {
value = var.CIRRUS_DAAC_VERSION
}
12 changes: 2 additions & 10 deletions tf/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@ variable "MATURITY" {
default = "dev"
}

variable "CIRRUS_CORE_BRANCH" {
variable "CIRRUS_CORE_VERSION" {
type = string
}

variable "CIRRUS_DAAC_BRANCH" {
type = string
}

variable "CIRRUS_CORE_TAG" {
type = string
}

variable "CIRRUS_DAAC_TAG" {
variable "CIRRUS_DAAC_VERSION" {
type = string
}

0 comments on commit 0b417bd

Please sign in to comment.