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

Feature/1301 no owner check for assets + Task/905 test callout payloads #1308

Merged
merged 10 commits into from
May 8, 2024

Conversation

JoernBerkefeld
Copy link
Contributor

@JoernBerkefeld JoernBerkefeld commented May 7, 2024

PR details

What changes did you make? (Give an overview)

Further details (optional)

...

Checklist

@JoernBerkefeld JoernBerkefeld added this to the 6.1.0 milestone May 7, 2024
@JoernBerkefeld JoernBerkefeld self-assigned this May 7, 2024
@github-actions github-actions bot added the enhancement New feature or request; requires increasing the minor version of mcdev. Jira issue-type "Story" label May 7, 2024
@JoernBerkefeld JoernBerkefeld changed the title Feature/1301 no owner check for assets Feature/1301 no owner check for assets + Task/905 test callout payloads May 7, 2024
@JoernBerkefeld JoernBerkefeld added c/asset COMPONENT e/DevOps EPIC chore Jira issue-type "Task" labels May 7, 2024
Copy link

github-actions bot commented May 7, 2024

Coverage Report

Commit:69f8990
Base: develop@fd951ea

Type Base This PR
Total Statements Coverage  65.87%  66.47%  (+0.6%)
Total Branches Coverage  67.03%  66.75%  (-0.28%)
Total Functions Coverage  75.49%  76.8%  (+1.31%)
Total Lines Coverage  65.87%  66.47%  (+0.6%)
Details (changed files):
File Statements Branches Functions Lines
lib/cli.js  0%  0%  0%  0%
lib/index.js  69.09%  56.75%  67.64%  69.09%
lib/metadataTypes/Asset.js  55.03%  50%  70.27%  55.03%
lib/metadataTypes/MetadataType.js  78.63%  74.68%  71.42%  78.63%
lib/util/auth.js  62%  76.47%  66.66%  62%

@JoernBerkefeld
Copy link
Contributor Author

JoernBerkefeld commented May 8, 2024

https://github.com/Accenture/sfmc-devtools/wiki/06.b-~-Standard-Commands/_edit

deploy

Command: mcdev deploy [business unit] [metadata type] [metadata key] [--fromRetrieve] [--refresh] [--keySuffix] [--noMidSuffix] [--changeKeyValue=yourNewKey] [--changeKeyField=otherFieldInJson] [--execute] [--schedule] [--fixShared]

Alias: mcdev d

deploy and change key:

Because of the special nature of the key field (with its various names across the metadata types) it cannot be simply updated by changing the value in the JSON. A deployment would otherwise trigger creating a new entry instead of updating the existing one. To still allow you to change the key value, like you could in the GUI, you have to use the optional parameters --changeKeyValue or --changeKeyField.

In some scenarios, all you want is to append a suffix (e.g. for assets because they share the key across BUs or for shared DataExtensions). For that, we've added --keySuffix. You can use it stand-alone or together with --changeKeyField. Be aware that if the maximum key-length is exhausted already, --keySuffix will automatically cut of the end of your existing key to add the suffix you specified!

Lastly, there is the option --noMidSuffix which deactivates automatically adding the MID suffix when you try to clone an asset to another BU. If you want to specify your own suffix to prevent the unique-key error during creation, this is your friend. Make sure to use this command together with --keySuffix or after applying a suffix via templating (buildTemplate/buildDefinition).

Examples:

# changeKeyField
mcdev deploy MyProject/DEV dataExtension --changeKeyField=Name
mcdev deploy MyProject/DEV dataExtension key2 --changeKeyField=Name
mcdev deploy MyProject/DEV dataExtension "key2,key3" --changeKeyField=Name

# changeKeyValue
mcdev deploy MyProject/DEV dataExtension key1 --changeKeyValue=key2

# keySuffix
mcdev deploy MyProject/DEV dataExtension --changeKeyField=Name --keySuffix "_DEV"
mcdev deploy MyProject/DEV dataExtension myKey --keySuffix "_DEV"
mcdev deploy MyProject/DEV dataExtension --keySuffix "_DEV"

# noMidSuffix
mcdev deploy MyProject/DEV asset--changeKeyField=name --noMidSuffix --keySuffix "_DEV"
mcdev deploy MyProject/DEV asset myKey --noMidSuffix --keySuffix "_DEV"
mcdev deploy MyProject/DEV asset --noMidSuffix --keySuffix "_DEV"

# noMidSuffix with templating
# - step 1 (create template with market that replaces for "_DEV")
mcdev buildTemplate MyProject/DEV asset myKey_DEV myMarketDEV
# - step 2 (filename stays unchanged after template creation for easier execution of buildDefinition)
mcdev buildDefinition MyProject/PROD asset myKey_DEV myMarketPROD
# - step 3 (key was changed to "myKey_PROD" by buildDefinition applying your prod market)
mcdev deploy MyProject/PROD asset myKey_PROD --noMidSuffix

The first of the 2 commands using --changeKeyField will deploy all dataExtensions in the deploy folder (optionally limited to the keys you specify) and try to overwrite their respective key with their name. Please ensure you check how that other field is spelled including upper-/lower-cased letters.

The second command uses --changeKeyValue can only be used if type AND key are specified. You pass along the exact new key value that we want to end up with. Therefore, in this example, your dataExtension with key "key1" will be updated to have the key "key2".

Note: Not every type allows updating the key. Please check our Metadata Type Support page for a full list.

@JoernBerkefeld JoernBerkefeld merged commit fe5b975 into develop May 8, 2024
9 checks passed
@JoernBerkefeld JoernBerkefeld deleted the feature/1301-no-owner-check-for-assets branch May 8, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/asset COMPONENT chore Jira issue-type "Task" e/DevOps EPIC enhancement New feature or request; requires increasing the minor version of mcdev. Jira issue-type "Story"
Projects
None yet
1 participant