Skip to content

Commit

Permalink
Merge pull request #581 from vlocityinc/beta
Browse files Browse the repository at this point in the history
Code Delivery from Beta to Master v1.17.2
  • Loading branch information
manas-sf authored Apr 6, 2023
2 parents 227bb1b + 4358980 commit f21dff0
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 4 deletions.
82 changes: 82 additions & 0 deletions devops/containers/sfdx-vlocity/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# base image
FROM node:14

# copy folders
COPY node-packages/ node-packages/
COPY sfdx-plugins/ sfdx-plugins/

## pre install env variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV SFDX_HIDE_RELEASE_NOTES=true

# install packages from http://deb.debian.org
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gnupg \
apt-utils \
apt-transport-https \
curl \
wget \
openssh-client \
ca-certificates \
jq \
bc \
gettext \
xmlstarlet \
bash \
python3 \
libxml2 \
libxml2-utils \
wget \
openjdk-11-jre \
&& wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
gh \
&& rm -rf /var/lib/apt/lists/*

# install packages from https://registry.npmjs.org
WORKDIR /node-packages
RUN cat ./package.json | jq '.devDependencies | keys[] as $k | "\($k)@\(.[$k])"' | xargs -t npm install --global

# install sfdx plugins from https://registry.npmjs.org
WORKDIR /sfdx-plugins
RUN chmod +x sfdx-plugins-installer.sh && ./sfdx-plugins-installer.sh

## post install env variables
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
ENV PATH="$PATH:$JAVA_HOME/bin"
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome
ENV SFDX_AUTOUPDATE_DISABLE=false
ENV SFDX_JSON_TO_STDOUT=true
ENV SFDX_USE_GENERIC_UNIX_KEYCHAIN=true
ENV SFDX_DOMAIN_RETRY=true
ENV SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_CREATE=true
ENV SFDX_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE=true
ENV SFDX_DISABLE_DNS_CHECK=true
ENV SHELL=/bin/bash

# tests
RUN java --version \
&& tsc -v \
&& sfdx --version \
&& sf --version \
&& sfdx plugins --core \
&& vlocity -v \
&& sfdx sgd -h \
&& gh --version

# clean
RUN rm -f ~/.npmrc \
&& rm -rf /node-packages \
&& rm -rf /sfdx-plugins
43 changes: 43 additions & 0 deletions devops/containers/sfdx-vlocity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# sfdx-vlocity

This docker image bundles all the dependencies needed for developing Vlocity Applications for Salesforce.

Developers can use this image to:

- run CI automations.
- create cloud or local development environments using docker containers.

## Dependencies

- Openjdk 11
- Node 14
- sfdx cli
- vlocity cli

### SFDX plugins

- sfdx-git-delta

## How to build

```shell
docker build --platform linux/amd64 --no-cache --progress plain .
```

## Tools to setup Development Environments using Containers

### Local

- [Docker Desktop](https://www.docker.com/products/docker-desktop/).

or Visual Studio Code|Github [`devcontainer.json`](https://containers.dev/implementors/json_reference/) files.

- [devcontainers cli](https://github.com/devcontainers/cli).

- Visual Studio Code extension called [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).

### Cloud

- [Codespaces](https://github.com/features/codespaces)

- [Gitpod](https://www.gitpod.io/)
12 changes: 12 additions & 0 deletions devops/containers/sfdx-vlocity/node-packages/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "global-dependencies",
"version": "1.0.0",
"description": "This package controls global npm dependencies",
"devDependencies": {
"typescript": "4.9.5",
"@salesforce/cli": "1.67.1",
"sfdx-cli": "7.188.1",
"vlocity": "1.17.0",
"puppeteer": "19.7.2"
}
}
8 changes: 8 additions & 0 deletions devops/containers/sfdx-vlocity/sfdx-plugins/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "sfdx-plugins",
"version": "1.0.0",
"description": "This package controls sfdx plugins",
"devDependencies": {
"sfdx-git-delta": "5.13.3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

for row in $(cat package.json | jq -c '.devDependencies | to_entries | .[]'); do
name=$(echo $row | jq -r '.key')
# sfdx plugins:install does not work with ~ and ^ https://github.com/forcedotcom/cli/issues/1966
version=$(echo $row | jq -r '.value' | cut -d "~" -f2 | cut -d "^" -f2)
echo "Installing $name@$version"
echo 'y' | sfdx plugins:install $name@$version
done
4 changes: 2 additions & 2 deletions lib/datapacksutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5058,7 +5058,7 @@ DataPacksUtils.prototype.updateDataPackWithNewMappings = function (dataPack, job

//Iterate through keys of <dataPack.VlocityDataPackData[dataField]> to update the keys(fieldNames)
Object.keys(obj[newDataField][0]).forEach(key => {
if (Object.keys(mappings.fieldNames).includes(key) && mappings.fieldNames[key] !== key) {
if (Object.keys(mappings.fieldNames).includes(key) && mappings.fieldNames[key] !== key && !Object.keys(obj[newDataField][0]).includes(mappings.fieldNames[key])) {
obj[newDataField][0][mappings.fieldNames[key]] = obj[newDataField][0][key];
delete obj[newDataField][0][key];
}
Expand Down Expand Up @@ -5101,7 +5101,7 @@ DataPacksUtils.prototype.updateDataPackWithNewMappings = function (dataPack, job
});
obj[newDataField][0].VlocityRecordSObjectType = newDataField;
// obj[newDataField][0].VlocityRecordSourceKey = obj[newDataField][0].VlocityRecordSourceKey.replace(new RegExp(dataField, 'g'), newDataField);
dataPack.VlocityDataPackData[newDataField] = obj[newDataField];
delete dataPack.VlocityDataPackData[dataField];
dataPack.VlocityDataPackData[newDataField] = obj[newDataField];
}
}
4 changes: 2 additions & 2 deletions lib/sfdx.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const shell = require('shelljs');

const _run = (command) => {
command = 'FORCE_COLOR=0 ' + command + ' --json';
const exec = shell.exec(command, { silent: true });
command += ' --json';
const exec = shell.exec(command, { env: { ...process.env, FORCE_COLOR: 0 }, silent: true });
let stdout;

try {
Expand Down

0 comments on commit f21dff0

Please sign in to comment.