Skip to content

Fix/update cert on restart#318

Open
sanjujunnuthula wants to merge 10 commits into
developmentfrom
fix/update-cert-on-restart
Open

Fix/update cert on restart#318
sanjujunnuthula wants to merge 10 commits into
developmentfrom
fix/update-cert-on-restart

Conversation

@sanjujunnuthula

Copy link
Copy Markdown
Contributor

updated harbor.sh and symphony.sh to sync harbor cert on sync and added few helper classes for more code readability

Ubuntu and others added 10 commits June 8, 2026 14:38
Signed-off-by: sanjujunnuthula <sanjuvardhan.junnuthula@capgemini.com>
Signed-off-by: sanjujunnuthula <sanjuvardhan.junnuthula@capgemini.com>
- Add copy_harbor_certificate() helper function to handle both CI and production certificate paths
- Update systemd service to check CI path first, then production path
- Add proper certificate directory creation before operations
- Increase delays in ExecStartPost to ensure CA update completes before restart
- Add NODE_EXTRA_CA_CERTS to all container runs (not just CI)
- Add error handling and validation for critical operations
- Improve logging for certificate operations
- Fix variable escaping in systemd here-doc (\${SYMPHONY_IMAGE_REF})
- Remove unused global HARBOR_CERT_SRC/DEST constants in favor of specific paths"
…ficate handling

- Add reusable copy_harbor_certificate() helper function for certificate management
- Add certificate path constants at the top of the file
- Simplify sync_harbor_cert_for_symphony() to use the new helper function
- Improve create_harbor_systemd_service() with proper certificate syncing in ExecStartPost
- Add error handling consistency for service status checks before restarts
- Clean up formatting and improve code maintainability
Signed-off-by: Ubuntu <margo@margo-wfm-v3.3kqag3nfqq2uvj5n0t1ulon1ge.xx.internal.cloudapp.net>
Signed-off-by: Ubuntu <margo@margo-wfm-v3.3kqag3nfqq2uvj5n0t1ulon1ge.xx.internal.cloudapp.net>
Signed-off-by: Ubuntu <margo@margo-wfm-v3.3kqag3nfqq2uvj5n0t1ulon1ge.xx.internal.cloudapp.net>
Signed-off-by: Ubuntu <margo@margo-wfm-v3.3kqag3nfqq2uvj5n0t1ulon1ge.xx.internal.cloudapp.net>
Comment thread scripts/modules/harbor.sh

# Helper function to locate and copy Harbor certificate
copy_harbor_certificate() {
local dest="$1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is dest? are you getting it from user input?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dest is the destination path, we are using this in the helper function, it takes the first argument passed through the function let us say copy_harbor_certificate "$symphony_cert_dir/harbor-ca.crt"

Comment thread scripts/modules/harbor.sh
fi
else
echo "⚠️ docker-compose.yml not found after prepare"
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is any changes done on these lines? seems indentation has been altered.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no changes done, just a proper format was made making the indentation to align.

Comment thread scripts/modules/harbor.sh
echo "❌ Harbor certificate invalid"
return 1
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason for these lines?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one to verify the harbor certs exists and the other if the cert exists then verifying the cert is valid

go build -o maestro || return 1
echo "✅ Maestro CLI built successfully"
fi
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason for changing this and adding one more condition for returning failure code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If go mod tidy fails, the script will still continue to build, this is to handle the build failure or any dependency errors

# Copy Harbor CA certificate from appropriate location
if ! copy_harbor_certificate "$HARBOR_CERT_DEST"; then
echo "⚠️ Warning: Harbor certificate not available, container may have SSL issues"
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if it has impact to sanity CI pipeline as copying of harbor certificate changed

@sanjujunnuthula sanjujunnuthula Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i had run the sanity CI, it worked, it doesn't affect sanity, sharing you the latest actions result
https://github.com/margo/sandbox/actions/runs/27628809051


[v3_req]
basicConstraints = CA:FALSE
basicConstraints = CA:TRUE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this for harbor certificates also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants