How do I save updated container?

I updated Docker container.
How do I publish it?

You can use the push step to push any container to your registry.

I assume that by “updated” you mean you changed the dockerfile. Or do you mean something else?

Not dockerfile.
Container.

You can use the docker save/export commands.

However, you won’t normally use these commands with Codefresh

Can you explain a bit what you are trying to do and what is your use case?

I am loading data into database for integration tests.
This happens four times in a pipeline - for four configurations.

For loading data into databases we suggest this approach Populate a database with existing data · Codefresh | Docs

It doesn’t modify the container itself. It simply loads data to a running container.

My use case is to deploy database with test data to Kubernetes, for UAT.
The test data is loaded by a Java+Gradle program.
So the approach above does not work for me.

An example of YAML that uses Docker commands commit and push would be helpful.

You cannot run direct Docker commands in Codefresh for security reasons. However I don’t see any complication with your case. Just package your Gradle/Java program in a docker image on its own

Then

 run_my_db_tests:
    stage: test
    image: 'maven:3.5.2-jdk-8-alpine'
    title: "Running integration tests"
    commands:
      - 'mvn integration-test'
    services:
      composition:
        my_postgresql_db:
          image: postgres:11.5
          ports:
            - 5432 
      setup:
        image: 'my-java-app-that-loads-data'
        commands:
          - "gradle load-my-data-in-the-db-task"

In the example above the docker image my-java-app-that-loads-data contains your app with gradle.

Would that work for you?

No.
Deployed to Kubernetes SQL Server image should contain test data.

Postgresql was just an example. You can use any db that you want that is packaged in a Docker image.

run_my_db_tests:
    stage: test
    image: 'maven:3.5.2-jdk-8-alpine'
    title: "Running integration tests"
    commands:
      - 'mvn integration-test'
    services:
      composition:
        my_mssql_db:
          image: mcr.microsoft.com/mssql/server:2019-latest
          ports:
            - 1433 
      setup:
        image: 'my-java-app-that-loads-data'
        commands:
          - "gradle load-my-data-in-the-db-task"

How do I deploy updated SQL Server container to Kubernetes?

Hello

The example I posted was about your use case where you said that a gradle/java project is loading data into your SQL server. Correct? If that is the case, I don’t see how you can have an updated container.

  1. You deploy the SQL container in Kubernetes as is
  2. You run the Gradle/Java program that loads data in the database. At this point the fact that the database is in a container or it is running in Kubernetes doesn’t matter anymore
  3. The database has the test data and you can do whatever you want with it. That’s it.

There is no need actually update a container on the spot or redeploy a changed container.

Can you offer some more insights on what exactly your requirements are?
Also can I ask what process did you have before moving to Kubernetes? Or is this a greenfield project?

How do I load data into database running in Kubernetes?

Once a day build and deploy database and webapp to Kubernetes for UAT.
Database data and webapp come from a repo and must match.

Yes.

Once you deploy any application to Kubernetes you can optionally expose it to outside connections. If for example your cluster is at 53.124.239.149 and you deploy an mssql server, you can make it listen at 53.124.239.149:1433

After that you can connect to it with any tool that supports mssql or use your Gradle app to load data. The fact that the db is running on Kubernetes is irrelevant to the connecting application.

There are many ways to expose it but the simplest one is to use a loadbalancer. See an example here gitops-kubernetes-configuration/service.yml at master · codefresh-contrib/gitops-kubernetes-configuration · GitHub . If you are using Kubernetes on the cloud, be sure to check the pricing first as using a Load balancer will affect your billing.

Exposing a Kubernetes application is not related to Codefresh pipelines. I suggest you do the loading of data first manually so that you understand Kubernetes networking and then add Codefresh in the mix instead of trying to make all things work at the same time.

Does that help?

How do I load data into database running in Kubernetes using CF pipeline?

load_data:
    image: 'gradle:4.7.0-jdk8-alpine'
    title: "Loading data in the db"
    commands:
      - 'gradle load-my-data-in-the-db-task'

How do I get IP address of the Kubernetes service the previous step deployed to?

You shouldn’t use IP addresses because they change all the time. You need to setup DNS in your Kubernetes cluster, so that you use a hostname like “my-db.my-kubernetes-cluster.com” or “my-app.my-kubernetes-cluster.com

If you insist on getting the IP it should something like

kubectl get svc  my-service -n my-namespace -o jsonpath='{.status.loadBalancer.ingress[0].ip}'