Sqitch:Snowflake, inside a Jenkins container on a windows host

122 views
Skip to first unread message

rudeb0y 101

unread,
Apr 29, 2020, 4:37:32 AM4/29/20
to Sqitch Users
I've been trying to experiment with snowflake/docker/sqitch/jenkins from windows.

I planned to use a sqitch image as the docker agent of a jenkins pipeline running in a container.

I can get sqitch container running, testing and working. I can run that container and deployment works.

When I run it from the Jenkins container, same steps, different result. It's like it can't see the /var/.snowsql config or something. However, just a basic check with snowsql works - seems sqitch commands are where things break down when trying from container in container approach. (account doesn't get parsed correctly and/or not using the config).

The documentation mentions "the best way to get sqitch running is to use the docker-sqitch.sh script" - I'm just unsure how I could use that to create the docker agent from Jenkins pipeline. I tried to do the volume mapping manually but I couldn't get it to work.

Does anyone have any experience on this set-up?

I think the next thing to try would be building a custom image of the jenkins server with sqitch baked in. Will probably work but might not be the best approach.

David E. Wheeler

unread,
Apr 29, 2020, 10:23:29 AM4/29/20
to rudeb0y 101, Sqitch Users
On Apr 29, 2020, at 04:37, rudeb0y 101 <stephen....@gmail.com> wrote:

> When I run it from the Jenkins container, same steps, different result. It's like it can't see the /var/.snowsql config or something. However, just a basic check with snowsql works - seems sqitch commands are where things break down when trying from container in container approach. (account doesn't get parsed correctly and/or not using the config).
>
> The documentation mentions "the best way to get sqitch running is to use the docker-sqitch.sh script" - I'm just unsure how I could use that to create the docker agent from Jenkins pipeline. I tried to do the volume mapping manually but I couldn't get it to work.

This sounds very much like a similar issue to this one, where the container couldn’t access /var/.snowsql in Azure pipelines:

https://github.com/sqitchers/docker-sqitch/issues/25

The solution was to connect to the container as root rather than the Sqitch user.

> Does anyone have any experience on this set-up?


Yes, at work we have a number of Jenkins pipelines that spin up a Postgres container with Sqitch and pgTAP already installed, something like this:


stage ('Test') {
steps {
script {
['11', '12'].each { version ->
docker.image(env.PGSQL_IMAGE).inside('-u root -e PGUSER=postgres -h db.example.com') {
// Start Postgres up and wait for it to be available,
// install required extensions, etc.
/bin/init_pgsql ${version} pgtap${version} pg_colnames${version}

// Test the widgets database.
sh "createdb widgets"
sh "sqitch deploy db:pg:widgets"
sh "sqitch rebase -y db:pg:widgets"
sh "pg_prove -d widgets --ext .sql -r test"
sh "sqitch revert -y db:pg:widgets"
}
}
}
}
}

env.PGSQL_IMAGE is set elsewhere to the custom Docker image we’ve built with tools for installing RPMs for specific versions of Postgres and starting a cluster.

> I think the next thing to try would be building a custom image of the jenkins server with sqitch baked in. Will probably work but might not be the best approach.

That would work, too, not too far from what we’ve done.

Best,

David

signature.asc
Reply all
Reply to author
Forward
0 new messages