Skip to content

Create opslevel-deploy.yml#1

Open
tozach wants to merge 1 commit intomainfrom
azure-devops
Open

Create opslevel-deploy.yml#1
tozach wants to merge 1 commit intomainfrom
azure-devops

Conversation

@tozach
Copy link

@tozach tozach commented Nov 18, 2024

No description provided.

Comment on lines +23 to +24
DEPLOYER_ID="$(Build.QueuedById)"
DEPLOYER_ID="${DEPLOYER_ID:-$(Build.QueuedById)}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DEPLOYER_ID="$(Build.QueuedById)"
DEPLOYER_ID="${DEPLOYER_ID:-$(Build.QueuedById)}"
DEPLOYER_ID="$(Build.QueuedById)"

DEPLOYER_NAME="$(Build.RequestedFor)"
DEPLOY_NUMBER="$(Build.BuildNumber)"
DEPLOY_URL="$(Build.BuildUri)"
VERSION="${VERSION:-$(git rev-parse --short HEAD)}" # Default to the current git commit hash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VERSION="${VERSION:-$(git rev-parse --short HEAD)}" # Default to the current git commit hash
VERSION="$(git rev-parse --short HEAD)"

DEPLOY_NUMBER="$(Build.BuildNumber)"
DEPLOY_URL="$(Build.BuildUri)"
VERSION="${VERSION:-$(git rev-parse --short HEAD)}" # Default to the current git commit hash
DESCRIPTION="${DESCRIPTION:-"Deployed by CI Pipeline: Deploy #${DEPLOY_NUMBER}"}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this works in AzureDevOps


# Payload for the OpsLevel API
data="{
\"dedup_id\": \"$(uuidgen)\",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be a unique ID per invocation - it should be the Build.BuildNumber or some sort of "pipeline" number. The purpose of the dedup_id is incase you need to retry the pipeline its considered the same event incase we received 2

Comment on lines +31 to +39
COMMIT_SHA="${COMMIT_SHA:-$(git rev-parse HEAD)}"
COMMIT_MESSAGE="${COMMIT_MESSAGE:-$(git log -1 --pretty=%B)}"
COMMIT_BRANCH="${COMMIT_BRANCH:-$(git rev-parse --abbrev-ref HEAD)}"
COMMIT_DATE="${COMMIT_DATE:-$(git show --no-patch --format='%cd')}"
COMMITTER_NAME="${COMMITTER_NAME:-$(git show --no-patch --format='%cn')}"
COMMITTER_EMAIL="${COMMITTER_EMAIL:-$(git show --no-patch --format='%ce')}"
AUTHOR_NAME="${AUTHOR_NAME:-$(git show --no-patch --format='%an')}"
AUTHOR_EMAIL="${AUTHOR_EMAIL:-$(git show --no-patch --format='%ae')}"
AUTHORING_DATE="${AUTHORING_DATE:-$(git show --no-patch --format='%ad')}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these have input environment variables - my understanding is they will always be blank.

So 2 things

  • Should we expose all (or some) of these as parameters?
  • Should we remove the variables and just run the git commands.

Comment on lines +2 to +11
- name: 'env'
default: 'Production'
type: string
- name: 'integrationId'
type: string
- name: 'serviceAlias'
type: string
- name: 'apiUrl'
default: 'https://app.opslevel.com/'
type: string
Copy link
Contributor

@rocktavious rocktavious Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alphabetize by parameters name

Suggested change
- name: 'env'
default: 'Production'
type: string
- name: 'integrationId'
type: string
- name: 'serviceAlias'
type: string
- name: 'apiUrl'
default: 'https://app.opslevel.com/'
type: string
- name: 'apiUrl'
default: 'https://app.opslevel.com/'
type: string
- name: 'env'
default: 'Production'
type: string
- name: 'integrationId'
type: string
- name: 'serviceAlias'
type: string

Copy link
Contributor

@rocktavious rocktavious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few "polish" things that need to be taken care of

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants