Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/DAT-11693' into DAT-12602
Browse files Browse the repository at this point in the history
  • Loading branch information
abrackx committed Jan 11, 2023
2 parents 1ceec55 + a4192eb commit 6e9163d
Show file tree
Hide file tree
Showing 97 changed files with 1,151 additions and 371 deletions.
20 changes: 10 additions & 10 deletions .github/util/package-install4j.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

###################################################################
## This script creates the installer files given an unziped directory
## This script creates the installer files given an unzipped directory
###################################################################

set -e
Expand All @@ -13,14 +13,14 @@ if [ -z ${1+x} ]; then
fi
version=$1

if [ -z ${INSTALL4J_LICENSE+x} ]; then
echo "INSTALL4J_LICENSE must be set";
if [ -z ${INSTALL4J_10_LICENSE+x} ]; then
echo "INSTALL4J_10_LICENSE must be set";
exit 1
fi


mkdir -p ~/.install4j8
export INSTALL4J_CACHE=$HOME/.install4j8
mkdir -p ~/.install4j10
export INSTALL4J_CACHE=$HOME/.install4j10

# install4jc="/usr/local/bin/install4jc"
install4jc="/Applications/install4j.app/Contents/Resources/app/bin/install4jc"
Expand All @@ -31,13 +31,13 @@ else
echo "$install4jc does not exist. Installing..."

# installer automation for ubuntu-latest; replaced
# wget -nv --directory-prefix=$INSTALL4J_CACHE -nc https://download-gcdn.ej-technologies.com/install4j/install4j_linux_8_0_11.deb
# sudo apt install -y $INSTALL4J_CACHE/install4j_linux_8_0_11.deb
# wget -nv --directory-prefix=$INSTALL4J_CACHE -nc https://download.ej-technologies.com/install4j/install4j_linux-x64_10_0_4.deb
# sudo apt install -y $INSTALL4J_CACHE/install4j_linux-x64_10_0_4.deb

# installer automation for macos-latest; macos needed for apple notarizing
wget -nv --directory-prefix=$INSTALL4J_CACHE -nc https://download-gcdn.ej-technologies.com/install4j/install4j_macos_8_0_11.dmg
wget -nv --directory-prefix=$INSTALL4J_CACHE -nc https://download.ej-technologies.com/install4j/install4j_macos_10_0_4.dmg
sleep 5
hdiutil attach /Users/runner/.install4j8/install4j_macos_8_0_11.dmg
hdiutil attach /Users/runner/.install4j10/install4j_macos_10_0_4.dmg
sleep 5
cp -rf /Volumes/install4j/install4j.app /Applications
sleep 5
Expand All @@ -54,6 +54,6 @@ else
INSTALL4J_ARGS="$INSTALL4J_ARGS --win-keystore-password=$INSTALL4J_WINDOWS_KEY_PASSWORD --mac-keystore-password=$INSTALL4J_APPLE_KEY_PASSWORD --apple-id=$INSTALL4J_APPLE_ID --apple-id-password=$INSTALL4J_APPLE_ID_PASSWORD"
fi

"$install4jc" --license=$INSTALL4J_LICENSE
"$install4jc" --license=$INSTALL4J_10_LICENSE
"$install4jc" $INSTALL4J_ARGS src/main/install4j/liquibase.install4j

12 changes: 7 additions & 5 deletions .github/workflows/create-release.yml
Expand Up @@ -8,14 +8,17 @@ on:
branch:
description: 'Branch to release (Defaults to master)'
required: false

runId:
description: 'RunId of liquibase/liquibase artifacts to attach'
required: true
jobs:
setup:
name: Setup
runs-on: ubuntu-20.04
outputs:
version: ${{ steps.collect-data.outputs.version }}
branch: ${{ steps.collect-data.outputs.branch }}
runId: ${{ steps.collect-data.outputs.runId }}
steps:
- name: Collect Data
id: collect-data
Expand All @@ -24,9 +27,9 @@ jobs:
script: |
core.setOutput("version", context.payload.inputs.version);
core.setOutput("branch", context.payload.inputs.branch || "master");
core.setOutput("runId", context.payload.inputs.runId);
- run: |
echo "Creating version ${{ steps.collect-data.outputs.version }} from ${{ steps.collect-data.outputs.branch }}"
echo "Creating version ${{ steps.collect-data.outputs.version }} from ${{ steps.collect-data.outputs.branch }} with artifacts from build ${{ steps.collect-data.outputs.runId }} "
reversion:
needs: [ setup ]
Expand All @@ -48,8 +51,7 @@ jobs:
uses: liquibase/action-download-artifact@v2-liquibase
with:
workflow: build.yml
workflow_conclusion: success
branch: ${{ needs.setup.outputs.branch }}
run_id: ${{ needs.setup.outputs.runId }}
name: liquibase-artifacts
path: download/liquibase-artifacts

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/installer-build-check.yml
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up JDK for GPG
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'
gpg-private-key: ${{ secrets.GPG_SECRET }}
gpg-passphrase: GPG_PASSPHRASE
Expand All @@ -38,7 +38,7 @@ jobs:

- name: Re-version Installers
env:
INSTALL4J_LICENSE: ${{ secrets.INSTALL4J_LICENSE }}
INSTALL4J_10_LICENSE: ${{ secrets.INSTALL4J_10_LICENSE }}
INSTALL4J_APPLE_KEY: ${{ secrets.INSTALL4J_APPLE_KEY }}
INSTALL4J_APPLE_KEY_PASSWORD: ${{ secrets.INSTALL4J_APPLE_KEY_PASSWORD }}
INSTALL4J_APPLE_ID: ${{ secrets.INSTALL4J_APPLE_ID }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-published.yml
Expand Up @@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Download release assets
uses: robinraju/release-downloader@v1.6
uses: robinraju/release-downloader@v1.7
with:
repository: "liquibase/liquibase"
tag: "${{ needs.setup.outputs.tag }}"
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
contents: read
steps:
- name: Download release javadocs
uses: robinraju/release-downloader@v1.6
uses: robinraju/release-downloader@v1.7
with:
repository: "liquibase/liquibase"
tag: "${{ needs.setup.outputs.tag }}"
Expand Down
Expand Up @@ -68,6 +68,7 @@ public CDILiquibaseConfig createCDILiquibaseConfig() {
final InputStream is = SchemesCDIConfigBuilder.class.getResourceAsStream(SCHEMA_NAME);
try {
return jvmLocked(id, new Callable<CDILiquibaseConfig>() {
@Override
public CDILiquibaseConfig call() throws Exception {
return createCDILiquibaseConfig(id, is);
}
Expand Down Expand Up @@ -190,7 +191,7 @@ CDILiquibaseConfig fileLocked(final String id, Callable<CDILiquibaseConfig> acti
FileLock lock = null;
try (
FileOutputStream fileStream = new FileOutputStream(lockPath);
FileChannel fileChannel = fileStream.getChannel();
FileChannel fileChannel = fileStream.getChannel()
)
{
while (null == lock) {
Expand Down
2 changes: 1 addition & 1 deletion liquibase-core/pom.xml
Expand Up @@ -115,7 +115,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.8.1</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>

Expand Down
Expand Up @@ -70,6 +70,7 @@ public ObjectMetaData getObjectMetaData() {
/**
* Return true if the given key is defined.
*/
@Override
public boolean has(String key) {
return get(key, Object.class) != null;
}
Expand Down Expand Up @@ -119,6 +120,7 @@ protected <T> T get(String attribute, T defaultValue, Class<T> type) {
}
}

@Override
public List getValuePath(String attributes, Class lastType) {
List path = new ArrayList();

Expand Down Expand Up @@ -230,6 +232,7 @@ public ExtensibleObject set(String attribute, Object value) {
return this;
}

@Override
public String describe() {
String name = getClass().getSimpleName();
return name + "{" + StringUtil.join(this, ", ", new StringUtil.DefaultFormatter()) + "}";
Expand Down
30 changes: 8 additions & 22 deletions liquibase-core/src/main/java/liquibase/Liquibase.java
Expand Up @@ -6,7 +6,9 @@
import liquibase.changelog.filter.*;
import liquibase.changelog.visitor.*;
import liquibase.command.CommandScope;
import liquibase.command.core.DbUrlConnectionCommandStep;
import liquibase.command.core.InternalDropAllCommandStep;
import liquibase.command.core.TagCommandStep;
import liquibase.database.Database;
import liquibase.database.DatabaseConnection;
import liquibase.database.DatabaseFactory;
Expand Down Expand Up @@ -1887,30 +1889,14 @@ public final void dropAll(CatalogAndSchema... schemas) throws DatabaseException

/**
* 'Tags' the database for future rollback
*
* @deprecated Use {link {@link CommandScope(String)} to tag instead of this method.
*/
public void tag(String tagString) throws LiquibaseException {
runInScope(new Scope.ScopedRunner() {
@Override
public void run() throws Exception {

LockService lockService = LockServiceFactory.getInstance().getLockService(database);
lockService.waitForLock();

try {
ChangeLogHistoryServiceFactory.getInstance().getChangeLogService(database).generateDeploymentId();

checkLiquibaseTables(false, null, new Contexts(),
new LabelExpression());
getDatabase().tag(tagString);
} finally {
try {
lockService.releaseLock();
} catch (LockException e) {
LOG.severe(MSG_COULD_NOT_RELEASE_LOCK, e);
}
}
}
});
new CommandScope("tag")
.addArgumentValue(DbUrlConnectionCommandStep.DATABASE_ARG, database)
.addArgumentValue(TagCommandStep.TAG_ARG, tagString)
.execute();
}

public boolean tagExists(String tagString) throws LiquibaseException {
Expand Down
Expand Up @@ -141,6 +141,7 @@ public void setProcedureText(String procedureText) {
this.procedureText = procedureText;
}

@Override
@DatabaseChangeProperty(
exampleValue = "h2, oracle",
since = "3.1"
Expand All @@ -149,6 +150,7 @@ public String getDbms() {
return dbms;
}

@Override
public void setDbms(final String dbms) {
this.dbms = dbms;
}
Expand Down
Expand Up @@ -211,6 +211,7 @@ public boolean createThisIndex(Index index) {
for (Column column : index.getColumns()) {
if (removedColumnNames.contains(column.getName())) {
indexContainsColumn = true;
break;
}
}
return !indexContainsColumn;
Expand Down
Expand Up @@ -121,6 +121,7 @@ public boolean generateRollbackStatementsVolatile(Database database) {
return true;
}

@Override
@DatabaseChangeProperty(description = "Name of the table to insert data into",
requiredForDatabase = ALL, mustEqualExisting = "table")
public String getTableName() {
Expand Down
Expand Up @@ -31,6 +31,7 @@ public void reset() {

}

@Override
public ChangeSet.RunStatus getRunStatus(final ChangeSet changeSet)
throws DatabaseException, DatabaseHistoryException {
RanChangeSet foundRan = getRanChangeSet(changeSet);
Expand Down Expand Up @@ -61,6 +62,7 @@ public ChangeSet.RunStatus getRunStatus(final ChangeSet changeSet)
}
}

@Override
public void upgradeChecksums(final DatabaseChangeLog databaseChangeLog, final Contexts contexts,
LabelExpression labels) throws DatabaseException {
for (RanChangeSet ranChangeSet : this.getRanChangeSets()) {
Expand Down Expand Up @@ -118,14 +120,17 @@ public String getLastDeploymentId() throws DatabaseException {

protected abstract void replaceChecksum(ChangeSet changeSet) throws DatabaseException;

@Override
public String getDeploymentId() {
return this.deploymentId;
}

@Override
public void resetDeploymentId() {
this.deploymentId = null;
}

@Override
public void generateDeploymentId() {
if (this.deploymentId == null) {
String dateString = String.valueOf(new Date().getTime());
Expand Down
Expand Up @@ -56,7 +56,7 @@ public ChangeLogHistoryService getChangeLogService(Database database) {
SortedSet<ChangeLogHistoryService> foundServices = new TreeSet<>(new Comparator<ChangeLogHistoryService>() {
@Override
public int compare(ChangeLogHistoryService o1, ChangeLogHistoryService o2) {
return -1 * Integer.valueOf(o1.getPriority()).compareTo(o2.getPriority());
return -1 * Integer.compare(o1.getPriority(), o2.getPriority());
}
});

Expand Down
Expand Up @@ -151,7 +151,7 @@ public String[] execute(String[] line) {
@Override
public List<RanChangeSet> getRanChangeSets() throws DatabaseException {
try (
Reader reader = new InputStreamReader(new FileInputStream(this.changeLogFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue());
Reader reader = new InputStreamReader(new FileInputStream(this.changeLogFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue())
)
{
CSVReader csvReader = new CSVReader(reader);
Expand Down Expand Up @@ -210,7 +210,7 @@ protected void replaceChangeSet(ChangeSet changeSet, ReplaceChangeSetLogic repla
Reader reader = new InputStreamReader(new FileInputStream(oldFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue());
Writer writer = new OutputStreamWriter(new FileOutputStream(newFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue());
CSVReader csvReader = new CSVReader(reader);
CSVWriter csvWriter = new CSVWriter(writer);
CSVWriter csvWriter = new CSVWriter(writer)
)
{
String[] line;
Expand Down Expand Up @@ -238,7 +238,7 @@ protected void appendChangeSet(ChangeSet changeSet, ChangeSet.ExecType execType)
Reader reader = new InputStreamReader(new FileInputStream(oldFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue());
Writer writer = new OutputStreamWriter(new FileOutputStream(newFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue());
CSVReader csvReader = new CSVReader(reader);
CSVWriter csvWriter = new CSVWriter(writer);
CSVWriter csvWriter = new CSVWriter(writer)
)
{
String[] line;
Expand Down Expand Up @@ -327,7 +327,7 @@ public int getNextSequenceValue() throws LiquibaseException {
lastChangeSetSequenceValue = 0;

try (
Reader reader = new InputStreamReader(new FileInputStream(this.changeLogFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue());
Reader reader = new InputStreamReader(new FileInputStream(this.changeLogFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue())
)
{

Expand Down
Expand Up @@ -98,6 +98,7 @@ protected String getCharTypeName() {
return "varchar";
}

@Override
public void init() throws DatabaseException {
if (serviceInitialized) {
return;
Expand Down Expand Up @@ -304,6 +305,7 @@ public void upgradeChecksums(final DatabaseChangeLog databaseChangeLog, final Co
/**
* Returns the ChangeSets that have been run against the current getDatabase().
*/
@Override
public List<RanChangeSet> getRanChangeSets() throws DatabaseException {
if (this.ranChangeSetList == null) {
Database database = getDatabase();
Expand Down
Expand Up @@ -3,6 +3,7 @@
import liquibase.changelog.ChangeSet;

public class IgnoreChangeSetFilter implements ChangeSetFilter {
@Override
public ChangeSetFilterResult accepts(ChangeSet changeSet) {
if (changeSet.isIgnore()) {
return new ChangeSetFilterResult(false, "Changeset is ignored", this.getClass());
Expand Down
@@ -0,0 +1,14 @@
package liquibase.command;

/**
* Interface implemented by CommandSteps when they need to execute clean up tasks (such as closing database
* connections, flushing files, etc) after other steps in the pipeline are executed.
*/
public interface CleanUpCommandStep {

/**
* Method invoked to execute the cleanup action.
* @param resultsBuilder builder used in this pipeline
*/
void cleanUp(CommandResultsBuilder resultsBuilder);
}

0 comments on commit 6e9163d

Please sign in to comment.