Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minor version #181

Merged
merged 6 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ The format of this file is based on

- TBD

## [2.22.0]

- Updated dependencies

## [2.21.0]

- Updated dependencies

## [2.20.0]

- Updated dependencies

## [2.19.3]

- Fix the image tag when deploying a dev image from main (#172 #173)
Expand All @@ -21,7 +33,6 @@ The format of this file is based on

- Updated dependencies


## [2.17.0]

- Updated dependencies
Expand Down
75 changes: 53 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fpd"
version = "2.21.0"
version = "2.22.0"
edition = "2018"
description = "The Fiberplane Daemon enables secure communication between Fiberplane and your data sources using WebAssembly-based providers."
authors = ["Fiberplane <info@fiberplane.com>"]
Expand All @@ -24,7 +24,7 @@ flate2 = "1"
futures = "0.3.17"
http = "0.2.4"
hyper = { version = "0.14.26", features = ["full"] }
octocrab = { version = "0.23", default-features = false, features = ["rustls"] }
octocrab = { version = "0.33", default-features = false, features = ["rustls"] }
once_cell = "1.15.0"
prometheus = { version = "0.13", default-features = false }
reqwest = { version = "0.11.7", default-features = false, features = [
Expand Down
44 changes: 37 additions & 7 deletions src/tasks/provider_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use clap::Parser;
use duct::cmd;
use fiberplane::provider_bindings::Timestamp;
use flate2::read::GzDecoder;
use futures::TryFutureExt;
use http::Uri;
use octocrab::models::{ArtifactId, JobId, RepositoryId};
use octocrab::{Octocrab, Page};
use secrecy::ExposeSecret;
Expand All @@ -16,6 +18,8 @@ use std::path::{Path, PathBuf};
use tar::Archive;
use thiserror::Error;

const GITHUB_BASE_URI: &str = "https://api.github.com";

#[derive(Debug, Error)]
pub enum Error {
#[error("Runtime error: {0}")]
Expand Down Expand Up @@ -117,9 +121,9 @@ async fn download_provider_artifacts_from_branch(
});
}

let archive_download_url = &latest_artifact.archive_download_url;

download_providers_archive(octocrab, archive_download_url, wasm_dir).await
// latest_artifact.
let download_url = &latest_artifact.archive_download_url;
download_providers_archive(octocrab, download_url, wasm_dir).await
}

async fn download_providers_release(
Expand Down Expand Up @@ -178,8 +182,21 @@ async fn download_providers_tarball(
eprintln!("Downloading providers tarball from: {download_url}");

let response = octocrab._get(download_url).await?;
let response = octocrab.follow_location_to_data(response).await?;
let tarball_bytes = hyper::body::to_bytes(response.into_body()).await?;
let tarball_bytes = if response.status().is_redirection() {
let header_value = response.headers().get("location").unwrap();
let location = header_value.to_str().unwrap().to_string();

let result = if location.starts_with(GITHUB_BASE_URI) {
let uri = location.parse::<Uri>().unwrap();
let response = octocrab._get(uri).await?;
hyper::body::to_bytes(response).await?
} else {
reqwest::get(location).await?.bytes().await?
};
result
} else {
hyper::body::to_bytes(response.into_body()).await?
};

let mut archive = Archive::new(GzDecoder::new(Cursor::new(tarball_bytes)));
for entry in archive.entries()? {
Expand Down Expand Up @@ -213,8 +230,21 @@ async fn download_providers_zip(
eprintln!("Downloading providers zip from: {download_url}");

let response = octocrab._get(download_url).await?;
let response = octocrab.follow_location_to_data(response).await?;
let zip_bytes = hyper::body::to_bytes(response.into_body()).await?;
let zip_bytes = if response.status().is_redirection() {
let header_value = response.headers().get("location").unwrap();
let location = header_value.to_str().unwrap().to_string();

let result = if location.starts_with(GITHUB_BASE_URI) {
let uri = location.parse::<Uri>().unwrap();
let response = octocrab._get(uri).await?;
hyper::body::to_bytes(response).await?
} else {
reqwest::get(location).await?.bytes().await?
};
result
} else {
hyper::body::to_bytes(response.into_body()).await?
};

let mut archive = zip::ZipArchive::new(Cursor::new(zip_bytes))?;
for i in 0..archive.len() {
Expand Down
Loading